instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
CREATE TABLE restaurant (
id int,
name varchar,
food_type varchar,
city_name varchar,
rating "decimal
)
CREATE TABLE location (
restaurant_id int,
house_number int,
street_name varchar,
city_name varchar
)
CREATE TABLE geographic (
city_name varchar,
county varchar,
reg... | SELECT location.house_number, restaurant.name FROM location, restaurant WHERE restaurant.city_name IN (SELECT GEOGRAPHICalias0.city_name FROM geographic AS GEOGRAPHICalias0 WHERE GEOGRAPHICalias0.region = 'bay area') AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5 | restaurants |
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 WHERE demographic.marital_status = "DIVORCED" AND demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" | mimicsql_data |
CREATE TABLE table_52913 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What Constructor has 56 Laps?
| SELECT "Constructor" FROM table_52913 WHERE "Laps" = '56' | wikisql |
CREATE TABLE table_7072 (
"Name" text,
"GP-GS" text,
"Yards" real,
"Long" real,
"Avg/G" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest average for a long less than 24, a GP-GS of 2-0, and less than 7 yards?
| SELECT MAX("Avg/G") FROM table_7072 WHERE "Long" < '24' AND "GP-GS" = '2-0' AND "Yards" < '7' | wikisql |
CREATE TABLE table_name_60 (
venue VARCHAR,
away_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What venue did melbourne play at as the away team?
| SELECT venue FROM table_name_60 WHERE away_team = "melbourne" | sql_create_context |
CREATE TABLE table_27723228_7 (
score VARCHAR,
team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the score for miami
| SELECT score FROM table_27723228_7 WHERE team = "Miami" | sql_create_context |
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 All_Road, Team_ID FROM basketball_match ORDER BY Team_ID DESC | nvbench |
CREATE TABLE table_15563 (
"Unit" text,
"Type" text,
"Net Power" text,
"Total Power" text,
"Finish construction" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the date that construction was finished when the unit was greifswald - 4 (kgr 4)... | SELECT "Finish construction" FROM table_15563 WHERE "Unit" = 'greifswald - 4 (kgr 4)' | wikisql |
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 COUNT(*) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '彭哲茂' AND t_kc22.STA_DATE BETWEEN '2014-06-18' AND '2014-12-24' AND t_kc22.SOC_SRT_DIRE_NM = '氟哌噻吨美利曲辛片' | css |
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose_val_rx text,
dose_unit_rx text,
route text
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE out... | SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2238) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.itemid IN (SE... | mimic_iii |
CREATE TABLE table_55601 (
"Player" text,
"Rec." real,
"Yards" real,
"Avg." real,
"TD's" real,
"Long" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the highest long of Charles Pauley with fewer than 60 yards?
| SELECT MAX("Long") FROM table_55601 WHERE "Player" = 'charles pauley' AND "Yards" < '60' | wikisql |
CREATE TABLE table_49609 (
"Region (year)" text,
"No. 1" text,
"No. 2" text,
"No. 3" text,
"No. 4" text,
"No. 5" text,
"No. 6" text,
"No. 7" text,
"No. 8" text,
"No. 9" text,
"No. 10" text
)
-- Using valid SQLite, answer the following questions for the tables provided above... | SELECT "Region (year)" FROM table_49609 WHERE "No. 7" = 'william' AND "No. 2" = 'alexander' | wikisql |
CREATE TABLE table_57681 (
"Res." text,
"Record" text,
"Opponent" text,
"Method" text,
"Event" text,
"Round" real,
"Time" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many rounds have an Opponent of sakae kasuya?
| SELECT COUNT("Round") FROM table_57681 WHERE "Opponent" = 'sakae kasuya' | wikisql |
CREATE TABLE table_name_85 (
engine VARCHAR,
entrant VARCHAR,
points VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What engine did Scuderia Ambrosiana with fewer than 4 points have?
| SELECT engine FROM table_name_85 WHERE entrant = "scuderia ambrosiana" AND points < 4 | sql_create_context |
CREATE TABLE table_71418 (
"Position" real,
"Club" text,
"Played" real,
"Points" text,
"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("Losses") FROM table_71418 WHERE "Draws" > '6' AND "Played" > '38' | wikisql |
CREATE TABLE table_13564 (
"Year" real,
"Stage" real,
"Start of stage" text,
"Distance (km)" text,
"Category of climb" text,
"Stage winner" text,
"Yellow jersey" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the stage winner when th... | SELECT "Stage winner" FROM table_13564 WHERE "Start of stage" = 'cauterets' | wikisql |
CREATE TABLE table_27540 (
"Season" text,
"Series" text,
"Team" text,
"Races" real,
"Wins" real,
"Poles" real,
"F/Laps" real,
"Podiums" real,
"Points" text,
"Position" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which races ha... | SELECT "Races" FROM table_27540 WHERE "Points" = '137' | wikisql |
CREATE TABLE table_16072 (
"Round" real,
"Choice" real,
"Overall" real,
"Player name" text,
"Position" text,
"College" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the name of the linebacker at Illinois college?
| SELECT "Player name" FROM table_16072 WHERE "Position" = 'Linebacker' AND "College" = 'Illinois' | wikisql |
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod tim... | SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT inputevents_cv.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM inputevents_cv WHERE DATETIME(inputevents_cv.charttime) >= DATETIME(CURRENT_TIME(), '-5 year') GROUP BY inputevents_cv.itemid) AS t1 WHERE t1.c1 <= 3) | mimic_iii |
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_Road, Team_ID FROM basketball_match | nvbench |
CREATE TABLE table_name_87 (
tournament VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What tournament took place on 7 Aug 2011?
| SELECT tournament FROM table_name_87 WHERE date = "7 aug 2011" | sql_create_context |
CREATE TABLE table_name_10 (
attendance INTEGER,
result VARCHAR,
week VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the largest number of people in attendance of the game with a W 14-3 result after week 10?
| SELECT MAX(attendance) FROM table_name_10 WHERE result = "w 14-3" AND week > 10 | sql_create_context |
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CRE... | SELECT u.Reputation / @Smoothing * /* Log(u.Reputation/@Smoothing+1), */ @Smoothing, COUNT(1) FROM Votes AS v INNER JOIN Posts AS p ON p.Id = v.PostId INNER JOIN Users AS u ON u.Id = p.OwnerUserId WHERE v.VoteTypeId IN (3) AND p.PostTypeId IN (1) AND p.Score < 0 AND u.Reputation < @MaxReputation GROUP BY u.Reputation /... | sede |
CREATE TABLE table_name_14 (
league_goals INTEGER,
playoff_goals VARCHAR,
position VARCHAR,
fa_cup_apps VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many goals for the FW with 0 FA cup appearances and over 0 playoff goals?
| SELECT MIN(league_goals) FROM table_name_14 WHERE position = "fw" AND fa_cup_apps = "0" AND playoff_goals > 0 | sql_create_context |
CREATE TABLE table_58282 (
"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 home team has an Away team score of 6.9 (4... | SELECT "Home team" FROM table_58282 WHERE "Away team score" = '6.9 (45)' | wikisql |
CREATE TABLE table_24014744_1 (
putri_pariwisata_indonesia VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who won 2nd place when albertina fransisca mailoa was the winner of the putri pariwisata contest?
| SELECT 1 AS st_runner_up FROM table_24014744_1 WHERE putri_pariwisata_indonesia = "Albertina Fransisca Mailoa" | sql_create_context |
CREATE TABLE table_name_52 (
place INTEGER,
points VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the aggregate of place for points being 35?
| SELECT SUM(place) FROM table_name_52 WHERE points = 35 | sql_create_context |
CREATE TABLE table_5903 (
"Date" text,
"Time" text,
"Score" text,
"Set 1" text,
"Set 2" text,
"Set 3" text,
"Total" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Total has a Set 2 of 19 25?
| SELECT "Total" FROM table_5903 WHERE "Set 2" = '19–25' | wikisql |
CREATE TABLE Behavior_Incident (
incident_id INTEGER,
incident_type_code VARCHAR(10),
student_id INTEGER,
date_incident_start DATETIME,
date_incident_end DATETIME,
incident_summary VARCHAR(255),
recommendations VARCHAR(255),
other_details VARCHAR(255)
)
CREATE TABLE Ref_Detention_Type (... | SELECT date_address_to, SUM(monthly_rental) FROM Student_Addresses GROUP BY other_details, date_address_to ORDER BY monthly_rental DESC | nvbench |
CREATE TABLE table_27712451_9 (
high_assists VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the high assists for march 14
| SELECT high_assists FROM table_27712451_9 WHERE date = "March 14" | sql_create_context |
CREATE TABLE table_name_91 (
region VARCHAR,
format VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which region had the CD maxi format?
| SELECT region FROM table_name_91 WHERE format = "cd maxi" | sql_create_context |
CREATE TABLE table_70880 (
"Title" text,
"Studio" text,
"Role" text,
"Leading lady" text,
"Director" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In which title was Ann Rutherford the leading lady for Joseph Kane?
| SELECT "Title" FROM table_70880 WHERE "Leading lady" = 'ann rutherford' AND "Director" = 'joseph kane' | wikisql |
CREATE TABLE table_name_98 (
carries INTEGER,
points VARCHAR,
touchdowns VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the sum of carries associated with 80 points and fewer than 16 touchdowns?
| SELECT SUM(carries) FROM table_name_98 WHERE points = 80 AND touchdowns < 16 | sql_create_context |
CREATE TABLE table_14752049_6 (
international_tourist_arrivals__2012_ VARCHAR,
rank VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When the 1 is the rank what is the overall amount of international tourist arrivals in 2012?
| SELECT COUNT(international_tourist_arrivals__2012_) FROM table_14752049_6 WHERE rank = 1 | sql_create_context |
CREATE TABLE accounts (
account_id number,
statement_id number,
account_details text
)
CREATE TABLE ref_document_types (
document_type_code text,
document_type_name text,
document_type_description text
)
CREATE TABLE documents (
document_id number,
document_type_code text,
project_... | SELECT project_id, project_details FROM projects | spider |
CREATE TABLE table_name_78 (
score VARCHAR,
home_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the score for the southern home team?
| SELECT score FROM table_name_78 WHERE home_team = "southern" | sql_create_context |
CREATE TABLE jybgb_jyjgzbb (
JYZBLSH number,
YLJGDM text,
jyjgzbb_id number
)
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,
... | SELECT * FROM jyjgzbb WHERE jyjgzbb.JCZBMC = (SELECT jyjgzbb.JCZBMC FROM jyjgzbb WHERE jyjgzbb.JYZBLSH = '64789671154') AND jyjgzbb.JCZBJGDW = (SELECT jyjgzbb.JCZBJGDW FROM jyjgzbb WHERE jyjgzbb.JYZBLSH = '64789671154') AND jyjgzbb.JCZBJGDL <= (SELECT jyjgzbb.JCZBJGDL FROM jyjgzbb WHERE jyjgzbb.JYZBLSH = '64789671154') | css |
CREATE TABLE member (
Member_ID int,
Card_Number text,
Name text,
Hometown text,
Level int
)
CREATE TABLE purchase (
Member_ID int,
Branch_ID text,
Year text,
Total_pounds real
)
CREATE TABLE membership_register_branch (
Member_ID int,
Branch_ID text,
Register_Year text... | SELECT Name, COUNT(*) FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.Branch_ID = T2.Branch_ID WHERE T1.Register_Year > 2015 GROUP BY T2.Branch_ID ORDER BY Name | nvbench |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2166" AND diagnoses.long_title = "Pneumococcal pneumonia [Streptococcus pneumoniae pneumonia]" | mimicsql_data |
CREATE TABLE table_75745 (
"Date" text,
"Opponent" text,
"Location" text,
"Result" text,
"Overall" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Overall with a Date that is february 4, 1964?
| SELECT "Overall" FROM table_75745 WHERE "Date" = 'february 4, 1964' | wikisql |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
CREATE TABLE zyjzjlb_jybgb (
YLJGDM_ZYJZJLB text,
BGDH number,
YLJGDM number
)
CREATE TABLE mzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
... | SELECT jybgb.BGRQ FROM jybgb WHERE jybgb.BGDH = '96606568115' | css |
CREATE TABLE table_203_308 (
id number,
"athlete" text,
"nation" text,
"olympics" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- in total , how many athlete medal leaders a... | SELECT COUNT("athlete") FROM table_203_308 WHERE "nation" = 'united states' | squall |
CREATE TABLE table_name_95 (
ends_lost INTEGER,
locale VARCHAR,
blank_ends VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Can you tell me the lowest Ends Lost that has the Locale of norway, and the Blank Ends larger than 17?
| SELECT MIN(ends_lost) FROM table_name_95 WHERE locale = "norway" AND blank_ends > 17 | sql_create_context |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_nam... | SELECT t1.spec_type_desc FROM (SELECT microbiologyevents.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM microbiologyevents WHERE DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY microbiologyevents.spec_type_desc) AS t1 WHERE t... | mimic_iii |
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate tim... | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE Location LIKE '%Cairo%' OR Location LIKE 'Amman' OR Location LIKE 'Doha' AND Reputation >= 1000 ORDER BY Reputation DESC | sede |
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 demographic (... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND demographic.dod_year <= "2158.0" | mimicsql_data |
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE cours... | SELECT COUNT(*) > 0 FROM course, program, program_course WHERE course.department = 'RCIDIV' AND course.number = 224 AND program_course.category LIKE '%Other%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_id | advising |
CREATE TABLE table_name_34 (
name VARCHAR,
date_from VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the name of the player that was loaned out on 13 August 2008 ?
| SELECT name FROM table_name_34 WHERE date_from = "13 august 2008" | sql_create_context |
CREATE TABLE table_204_100 (
id number,
"date" text,
"name of ship" text,
"nationality" text,
"tonnage" number,
"fate" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many ships were from the united kingdom that were attacked by hans rudolf r... | SELECT COUNT("name of ship") FROM table_204_100 WHERE "nationality" = 'united kingdom' | squall |
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 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 = '0389131' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2003-09-03' AND '2008-03-14' GROUP BY t_kc21.MED_ORG_DEPT_CD HAVING SUM(t_kc24.MED_AMOUT) > 1563.42) AS T | css |
CREATE TABLE table_name_71 (
week VARCHAR,
hot_100_reaction VARCHAR,
performer_s_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which week has hot 100 reaction as did not debut for Natalie Cole?
| SELECT week FROM table_name_71 WHERE hot_100_reaction = "did not debut" AND performer_s_ = "natalie cole" | sql_create_context |
CREATE TABLE table_2679061_6 (
nhl_team VARCHAR,
position VARCHAR,
nationality VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the nhl team for the position centre and nationality united states?
| SELECT nhl_team FROM table_2679061_6 WHERE position = "Centre" AND nationality = "United States" | sql_create_context |
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 lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "MORBID OBESITY/SDA" | mimicsql_data |
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,
basic_type varchar,
engines int,
propulsion varchar,
wide_body varchar,
wing_span int,
length int,
weight i... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MONTREAL' AND CITY_2.c... | atis |
CREATE TABLE table_name_94 (
best_blocker VARCHAR,
league_champion VARCHAR,
cantsleep_award VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the best blocker for the year that has a League Champion of queens of pain, and a C.A.N.T.S.L.E.E.P. Award ... | SELECT best_blocker FROM table_name_94 WHERE league_champion = "queens of pain" AND cantsleep_award = "chassis crass (brooklyn)" | sql_create_context |
CREATE TABLE table_name_10 (
opponent VARCHAR,
loss VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What opponent has a loss of McCaskill (9-11)?
| SELECT opponent FROM table_name_10 WHERE loss = "mccaskill (9-11)" | sql_create_context |
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose_val_rx text,
dose_unit_rx text,
route text
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
... | 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 = 'gastric tube irrigat ... | mimic_iii |
CREATE TABLE journal_committee (
editor_id number,
journal_id number,
work_type text
)
CREATE TABLE editor (
editor_id number,
name text,
age number
)
CREATE TABLE journal (
journal_id number,
date text,
theme text,
sales number
)
-- Using valid SQLite, answer the following q... | SELECT age FROM editor GROUP BY age ORDER BY COUNT(*) DESC LIMIT 1 | spider |
CREATE TABLE table_name_19 (
withdrawn VARCHAR,
lswr_no VARCHAR,
to_iow VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the number of the year withdrawn for a LSWR number greater than 210 and a To LoW year of 1923?
| SELECT COUNT(withdrawn) FROM table_name_19 WHERE lswr_no > 210 AND to_iow = 1923 | sql_create_context |
CREATE TABLE table_name_92 (
date VARCHAR,
week VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the date of week 7
| SELECT date FROM table_name_92 WHERE week = 7 | 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 * FROM hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON 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_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_i... | css |
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
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 nu... | 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 = 'destruct ext ear les nec') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 56201) AND... | mimic_iii |
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE CloseReasonTypes (
Id number,
... | WITH C AS (SELECT p.Id FROM Posts AS p INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE CreationDate > '2017-09-23' AND t.TagName = 'blazor' AND (PostTypeId = 1)) SELECT COUNT(*), CASE WHEN Score < 0 THEN '<0' WHEN Score = 0 THEN '=0' WHEN Score > 0 THEN '>0' END AS score2 FRO... | sede |
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 LAST_NAME, COUNT(LAST_NAME) FROM employees WHERE SALARY > (SELECT SALARY FROM employees WHERE EMPLOYEE_ID = 163) GROUP BY LAST_NAME ORDER BY LAST_NAME | nvbench |
CREATE TABLE table_8219 (
"Office" text,
"Type" text,
"Location" text,
"Took Office" text,
"Left Office" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What date did the executive office in Dover take office?
| SELECT "Took Office" FROM table_8219 WHERE "Location" = 'dover' AND "Type" = 'executive' | wikisql |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
ic... | SELECT MAX(vitalperiodic.sao2) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-19726')) AND NOT vitalperiodic.sao2 IS NULL AND STRFT... | eicu |
CREATE TABLE table_20325360_2 (
total INTEGER,
country_territory VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many competitors in total, for the Mr. International competition, does Brazil have?
| SELECT MAX(total) FROM table_20325360_2 WHERE country_territory = "Brazil" | sql_create_context |
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
-- Using valid SQLite, answer the following questions for the... | SELECT Price, Manufacturer FROM Products WHERE Price BETWEEN 60 AND 120 | nvbench |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE cost (
c... | SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'colace' AND patient.uniquepid = '030-53416') AS t1 JOIN (SELECT patient.uniquepid, medication.drugstarttime FROM medicati... | eicu |
CREATE TABLE table_name_11 (
opponent VARCHAR,
method VARCHAR,
res VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- The tko (doctor stoppage) method was used in a loss against which opponent?
| SELECT opponent FROM table_name_11 WHERE method = "tko (doctor stoppage)" AND res = "loss" | sql_create_context |
CREATE TABLE table_20505342_1 (
drop_goals INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Lowest number of drop goals?
| SELECT MIN(drop_goals) FROM table_20505342_1 | sql_create_context |
CREATE TABLE table_name_49 (
top_10 INTEGER,
tournament VARCHAR,
top_25 VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest top-10 that has a u.s. open for the tournament, and a top-25 greater than 12?
| SELECT MAX(top_10) FROM table_name_49 WHERE tournament = "u.s. open" AND top_25 > 12 | sql_create_context |
CREATE TABLE table_train_141 (
"id" int,
"gender" string,
"hypothyroidism" bool,
"depression" bool,
"mini_mental_state_examination_mmse" int,
"neuropsychiatric_diagnoses" bool,
"memory_box" float,
"early_stage_ad" bool,
"head_injury" bool,
"stroke" bool,
"body_weight" float,
... | SELECT * FROM table_train_141 WHERE (gender = 'male' OR gender = 'female') AND (age >= 55 AND age <= 85) AND early_stage_ad = 1 OR (clinical_dementia_rating_cdr = 0.5 OR clinical_dementia_rating_cdr = 1 AND memory_box >= 0.5) OR mini_mental_state_examination_mmse >= 20 OR rbans_dmi <= 85 | criteria2sql |
CREATE TABLE table_150343_3 (
total VARCHAR,
country_territory VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Venezuela's total rank?
| SELECT total FROM table_150343_3 WHERE country_territory = "Venezuela" | 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 prescriptions... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Cardiogenic shock" | mimicsql_data |
CREATE TABLE table_name_18 (
category VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What car was awarded sub 1 litre in 2000?
| SELECT 2000 FROM table_name_18 WHERE category = "sub 1 litre" | sql_create_context |
CREATE TABLE ftxmzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH number,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
KH text,
KLX number,
MJZH text,
ML number,
MZZYZDZZBM text,
MZZYZD... | SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGD... | css |
CREATE TABLE table_20306 (
"Episode" text,
"Broadcast date" text,
"Run time" text,
"Viewers (in millions)" text,
"Archive" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What episode had a run time of 24:25?
| SELECT "Episode" FROM table_20306 WHERE "Run time" = '24:25' | wikisql |
CREATE TABLE table_name_84 (
celebrity VARCHAR,
famous_for VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What celebrity is famous for being an actor?
| SELECT celebrity FROM table_name_84 WHERE famous_for = "actor" | 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 prescriptions... | SELECT demographic.age, demographic.gender FROM demographic WHERE demographic.name = "Cynthia Gomez" | mimicsql_data |
CREATE TABLE table_name_60 (
date VARCHAR,
opponent_in_the_final VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When did Mathieu play against Flavio Cipolla?
| SELECT date FROM table_name_60 WHERE opponent_in_the_final = "flavio cipolla" | sql_create_context |
CREATE TABLE table_19860361_3 (
pixie_and_dixie VARCHAR,
ep VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Pixie and Dixie skit in episode 7?
| SELECT pixie_and_dixie FROM table_19860361_3 WHERE ep = 7 | sql_create_context |
CREATE TABLE jyjgzbb (
BGDH text,
BGRQ time,
CKZFWDX text,
CKZFWSX number,
CKZFWXX number,
JCFF text,
JCRGH text,
JCRXM text,
JCXMMC text,
JCZBDM text,
JCZBJGDL number,
JCZBJGDW text,
JCZBJGDX text,
JCZBMC text,
JLDW text,
JYRQ time,
JYZBLSH text,
... | SELECT mzjzjlb.YLJGDM FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE hz_info.RYBH = '68891668' UNION SELECT hz_info_zyjzjlb.YLJGDM FROM hz_info JOIN zyjzjlb JOIN hz_info_zyjzjlb ON hz_info.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info.KH = zyjz... | css |
CREATE TABLE person (
name text,
age number,
city text,
gender text,
job text
)
CREATE TABLE personfriend (
name text,
friend text,
year number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which person whose friends have the oldest average... | SELECT T2.name, AVG(T1.age) FROM person AS T1 JOIN personfriend AS T2 ON T1.name = T2.friend GROUP BY T2.name ORDER BY AVG(T1.age) DESC LIMIT 1 | spider |
CREATE TABLE table_74592 (
"Club" text,
"Played" real,
"Lost" real,
"Drawn" real,
"Against" real,
"Diff." real,
"Points" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the sum of losses for teams with less than 4 games played?
| SELECT SUM("Lost") FROM table_74592 WHERE "Played" < '4' | wikisql |
CREATE TABLE table_name_6 (
city VARCHAR,
third VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- WHAT IS THE CITY WITH THIRD AS LORI OLSON-JOHNS?
| SELECT city FROM table_name_6 WHERE third = "lori olson-johns" | sql_create_context |
CREATE TABLE table_39054 (
"Pos." real,
"Matches" real,
"Wins" real,
"Loses" real,
"Results" text,
"Points" real,
"Diff." text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Loses of 2, and a Pos. smaller than 2 had how many highest matches?
| SELECT MAX("Matches") FROM table_39054 WHERE "Loses" = '2' AND "Pos." < '2' | wikisql |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
... | SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(DEPARTMENT_ID) DESC | nvbench |
CREATE TABLE table_203_610 (
id number,
"institution" text,
"location" text,
"nickname" text,
"founded" number,
"historical affiliation" text,
"enrollment" number,
"primary conference" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how m... | SELECT COUNT("institution") FROM table_203_610 WHERE "historical affiliation" = 'private' | squall |
CREATE TABLE table_76265 (
"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.
-- Which ... | SELECT MIN("Game") FROM table_76265 WHERE "High assists" = 's. threatt (9)' | wikisql |
CREATE TABLE table_name_96 (
location VARCHAR,
time VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In which location did the fight last just 0:31?
| SELECT location FROM table_name_96 WHERE time = "0:31" | sql_create_context |
CREATE TABLE table_38521 (
"Round" text,
"Player" text,
"Position" text,
"Nationality" text,
"College/Junior/Club Team (League)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In round 9 what was the nationality?
| SELECT "Nationality" FROM table_38521 WHERE "Round" = '9' | wikisql |
CREATE TABLE gas_station (
Station_ID int,
Open_Year int,
Location text,
Manager_Name text,
Vice_Manager_Name text,
Representative_Name text
)
CREATE TABLE station_company (
Station_ID int,
Company_ID int,
Rank_of_the_Year int
)
CREATE TABLE company (
Company_ID int,
Rank i... | SELECT Main_Industry, COUNT(Main_Industry) FROM company WHERE Headquarters <> 'USA' GROUP BY Main_Industry ORDER BY Main_Industry DESC | nvbench |
CREATE TABLE table_43201 (
"s Member state" text,
"GDP 2012 millions of euro" text,
"Population in millions" real,
"GDP (PPP) per capita 2012 euro" text,
"GDP (Nominal) per capita 2012 euro" text,
"GDP (PPP) per capita 2012 EU27 = 100" text
)
-- Using valid SQLite, answer the following questio... | SELECT "GDP 2012 millions of euro" FROM table_43201 WHERE "Population in millions" < '1.3' AND "GDP (Nominal) per capita 2012 euro" = '20,700(p)' | wikisql |
CREATE TABLE table_12608427_8 (
no INTEGER,
name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the number for De Vries?
| SELECT MIN(no) FROM table_12608427_8 WHERE name = "de Vries" | sql_create_context |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE prescription... | SELECT demographic.gender, procedures.short_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "7578" | mimicsql_data |
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 COUNT(*) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_ID = '06002285' AND t_kc22.STA_DATE BETWEEN '2015-05-16' AND '2018-08-07' AND t_kc22.SOC_SRT_DIRE_NM = '妥布霉素滴眼液' | css |
CREATE TABLE table_name_13 (
country VARCHAR,
place VARCHAR,
player VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- WHAT COUNTRY HAS A T7 PLACE, WITH IAN WOOSNAM?
| SELECT country FROM table_name_13 WHERE place = "t7" AND player = "ian woosnam" | sql_create_context |
CREATE TABLE table_40523 (
"Match No." text,
"Home Team" text,
"Score" text,
"Away Team" text,
"Attendance" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the attendance of the match with F.C. central chugoku as the home team?
| SELECT "Attendance" FROM table_40523 WHERE "Home Team" = 'f.c. central chugoku' | wikisql |
CREATE TABLE table_149330_1 (
general_election VARCHAR,
votes_swing VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which general election had a vote swing of 1.69?
| SELECT general_election FROM table_149330_1 WHERE votes_swing = "1.69" | sql_create_context |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.