instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
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 outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime ... | SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'umbilical vein cath') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 30307) AND STRFTIME('%y', proce... | mimic_iii |
CREATE TABLE table_name_66 (
attendance VARCHAR,
week VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- For week 15, what was the total number of attendance recorded?
| SELECT COUNT(attendance) FROM table_name_66 WHERE week = 15 | sql_create_context |
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment text,
Text text,
ContentLicense text
)
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationD... | SELECT DATENAME(dw, CreationDate), COUNT(1) FROM Posts WHERE CreationDate > DATEADD(DAY, -120, CURRENT_TIMESTAMP()) AND ParentId IS NULL GROUP BY DATENAME(dw, CreationDate) ORDER BY COUNT(1) | sede |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Comments (
Id number,... | SELECT u.Id, u.Reputation, (SELECT COUNT(*) FROM Votes WHERE VoteTypeId IN (2, 3) AND PostId IN (SELECT Id FROM Posts WHERE PostTypeId = 1 AND OwnerUserId = u.Id)) AS "aggregate_number_of_votes_received_on_questions" FROM Users AS u WHERE u.Id IN (83, 2926, 3289, 5862, 6292, 8705) | sede |
CREATE TABLE table_1341598_44 (
first_elected INTEGER,
candidates VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What year were the election results tom loeffler (r) 80.6% joe sullivan (d) 19.4%?
| SELECT MIN(first_elected) FROM table_1341598_44 WHERE candidates = "Tom Loeffler (R) 80.6% Joe Sullivan (D) 19.4%" | sql_create_context |
CREATE TABLE table_50832 (
"Year" text,
"Team" text,
"Attempts" text,
"Completions" text,
"Completion %" text,
"Yards" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What team did James Vanderberg belong to when the Completions had a status of r... | SELECT "Team" FROM table_50832 WHERE "Completions" = 'redshirt' | wikisql |
CREATE TABLE table_27703902_9 (
high_points VARCHAR,
game VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who had the high points in game is 81?
| SELECT high_points FROM table_27703902_9 WHERE game = 81 | sql_create_context |
CREATE TABLE jybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH text,
BGJGDM text,
BGJGMC text,
BGRGH text,
BGRQ time,
BGRXM text,
BGSJ time,
CJRQ time,
JSBBRQSJ time,
JSBBSJ time,
JYBBH text,
JYJGMC text,
JYJSGH text,
JYJSQM text,
JY... | SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM 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.... | css |
CREATE TABLE table_15676 (
"Artist" text,
"Country of origin" text,
"Period active" text,
"Release-year of first charted record" real,
"Genre" text,
"Claimed sales" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the number of claimed sal... | SELECT "Claimed sales" FROM table_15676 WHERE "Genre" = 'rock' | wikisql |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
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,
... | SELECT COUNT(*) FROM hz_info JOIN zzmzjzjlb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX WHERE hz_info.RYBH = '59410862' AND zzmzjzjlb.JZKSRQ BETWEEN '2008-01-03' AND '2013-04-06' AND zzmzjzjlb.YLJGDM = '1012815' UNION SELECT COUNT(*) FROM hz_info JOIN fzzmzjzjlb ON... | css |
CREATE TABLE table_name_81 (
game INTEGER,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which game is on mar 12?
| SELECT AVG(game) FROM table_name_81 WHERE date = "mar 12" | sql_create_context |
CREATE TABLE table_15401 (
"Frame size" text,
"Width" real,
"Height" real,
"Mpix" real,
"Aspect Ratio" text,
"max. fps" real,
"lowest possible REDCODE at 24 fps" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What frame size corresponds the ... | SELECT "Frame size" FROM table_15401 WHERE "max. fps" = '120' AND "Width" = '2048' AND "Height" = '1024' | wikisql |
CREATE TABLE table_2668243_25 (
party VARCHAR,
incumbent VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What party did john s. barbour represent?
| SELECT party FROM table_2668243_25 WHERE incumbent = "John S. Barbour" | sql_create_context |
CREATE TABLE table_name_37 (
starts INTEGER,
winnings VARCHAR,
wins VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Can you tell me the sum of Starts that the Winnings of $139,774, and the Wins smaller than 0?
| SELECT SUM(starts) FROM table_name_37 WHERE winnings = "$139,774" AND wins < 0 | sql_create_context |
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 RZBQDM, RZBQMC, RYCWH FROM zyjzjlb WHERE JZLSH = '49376399892' | css |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
C... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.discharge_location = "REHAB/DISTINCT PART HOSP" AND diagnoses.short_title = "Injury-hanging" | mimicsql_data |
CREATE TABLE table_49379 (
"Result" text,
"Race" text,
"Distance" text,
"Weight" real,
"Winner or 2nd" text,
"Pos'n" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the result of the sajc king's cup race, which has a weight heavier than 8... | SELECT "Result" FROM table_49379 WHERE "Weight" > '8.1' AND "Race" = 'sajc king''s cup' | wikisql |
CREATE TABLE table_10539 (
"Episode #" text,
"Title" text,
"Directed by" text,
"Written by" text,
"Original airdate" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the original air date when ed horowitz wrote it?
| SELECT "Original airdate" FROM table_10539 WHERE "Written by" = 'ed horowitz' | wikisql |
CREATE TABLE equipment_sequence (
aircraft_code_sequence varchar,
aircraft_code varchar
)
CREATE TABLE compartment_class (
compartment varchar,
class_type varchar
)
CREATE TABLE fare_basis (
fare_basis_code text,
booking_class text,
class_type text,
premium text,
economy text,
... | SELECT DISTINCT ground_service.transport_type FROM airport, airport_service, city, ground_service WHERE airport.airport_code = airport_service.airport_code AND city.city_code = airport_service.city_code AND city.city_name = 'BOSTON' AND ground_service.airport_code = airport.airport_code | atis |
CREATE TABLE route (
train_id int,
station_id int
)
CREATE TABLE weekly_weather (
station_id int,
day_of_week text,
high_temperature int,
low_temperature int,
precipitation real,
wind_speed_mph int
)
CREATE TABLE train (
id int,
train_number int,
name text,
origin text,... | SELECT local_authority, COUNT(local_authority) FROM station GROUP BY local_authority ORDER BY local_authority | nvbench |
CREATE TABLE table_name_85 (
route VARCHAR,
elevation VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Elevation of 11,158 feet 3401 m had what route?
| SELECT route FROM table_name_85 WHERE elevation = "11,158 feet 3401 m" | sql_create_context |
CREATE TABLE table_16091 (
"School Year" text,
"Class A" text,
"Class AA" text,
"Class AAA" text,
"Class AAAA" text,
"Class AAAAA" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was Class AAA during the school year of 2000-01?
| SELECT "Class AAA" FROM table_16091 WHERE "School Year" = '2000-01' | wikisql |
CREATE TABLE claims (
claim_id number,
fnol_id number,
effective_date time
)
CREATE TABLE first_notification_of_loss (
fnol_id number,
customer_id number,
policy_id number,
service_id number
)
CREATE TABLE services (
service_id number,
service_name text
)
CREATE TABLE settlements ... | SELECT t2.date_opened, t2.date_closed FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name LIKE "%Diana%" | spider |
CREATE TABLE table_23242933_2 (
no_in_series INTEGER,
written_by VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What's the series number of the episode written by Dan Vebber?
| SELECT MAX(no_in_series) FROM table_23242933_2 WHERE written_by = "Dan Vebber" | sql_create_context |
CREATE TABLE table_train_12 (
"id" int,
"sequential_organ_failure_assessment_sofa" int,
"active_infection" bool,
"taking_pioglitazone" bool,
"taking_rosiglitazone" bool,
"body_weight" float,
"diabetic" string,
"organ_failure" bool,
"age" float,
"NOUSE" float
)
-- Using valid SQ... | SELECT * FROM table_train_12 WHERE age >= 13 | criteria2sql |
CREATE TABLE table_name_45 (
away VARCHAR,
attendance VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What team was the away team for the game with 916 in attendance?
| SELECT away FROM table_name_45 WHERE attendance = 916 | sql_create_context |
CREATE TABLE table_name_36 (
record VARCHAR,
game_site VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What record has candlestick park as the game site, and october 12, 2008 as the date?
| SELECT record FROM table_name_36 WHERE game_site = "candlestick park" AND date = "october 12, 2008" | sql_create_context |
CREATE TABLE table_name_9 (
transfer_fee VARCHAR,
country VARCHAR,
transfer_window VARCHAR,
type VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the transfer fee when summer is the transfer window, the type is transfer and the country is Hun?
| SELECT transfer_fee FROM table_name_9 WHERE transfer_window = "summer" AND type = "transfer" AND country = "hun" | sql_create_context |
CREATE TABLE table_204_374 (
id number,
"event" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number,
"ranking" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- only year in which switzerland earned 9 silver medals
| SELECT "event" FROM table_204_374 WHERE "silver" = 9 | squall |
CREATE TABLE table_13673 (
"Outcome" text,
"Date" text,
"Tournament" text,
"Surface" text,
"Opponent" text,
"Score" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the date when the tournament is san diego and the opponent is ann grossman... | SELECT "Date" FROM table_13673 WHERE "Tournament" = 'san diego' AND "Opponent" = 'ann grossman' | wikisql |
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
ViewCount number,
Body text,
OwnerUserId number,
OwnerDisplayName text,
LastEditorUserId number,
LastEditorDisplayName text... | SELECT Users.Id AS "user_link", Users.Reputation AS UserReputation FROM Users GROUP BY Users.Id, DisplayName, Users.Reputation ORDER BY UserReputation DESC LIMIT 1000 | sede |
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 WHERE demographic.gender = "F" AND demographic.ethnicity = "ASIAN" | mimicsql_data |
CREATE TABLE table_9952 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text,
"Money ($)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Place of the Player with a Score of 70-75-70-74=289?
| SELECT "Place" FROM table_9952 WHERE "Score" = '70-75-70-74=289' | wikisql |
CREATE TABLE zyb (
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 qtb.IN_DIAG_DIS_CD, qtb.IN_DIAG_DIS_NM FROM qtb WHERE qtb.PERSON_ID = '80270684' AND qtb.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 3516.12) UNION SELECT gyb.IN_DIAG_DIS_CD, gyb.IN_DIAG_DIS_NM FROM gyb WHERE gyb.PERSON_ID = '80270684' AND gyb.MED_CLINIC_ID IN (SELECT t_kc2... | css |
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 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 = '029-30149')) AND lab.labname = 'wbc x 1000' AND DATETIME(lab.labresulttime) >= DATE... | eicu |
CREATE TABLE table_name_37 (
opponent VARCHAR,
game VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What team were the Opponent in Game 29?
| SELECT opponent FROM table_name_37 WHERE game = 29 | sql_create_context |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,... | SELECT COUNT(DISTINCT icustays.icustay_id) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26612) AND STRFTIME('%y', icustays.intime) <= '2103' | mimic_iii |
CREATE TABLE table_50337 (
"Team" text,
"Winners" real,
"Runners-Up" real,
"Years Won" text,
"Years Runner-Up" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When there are more than 1 winners and the team playing is pachuca, what's the lowest runne... | SELECT MIN("Runners-Up") FROM table_50337 WHERE "Team" = 'pachuca' AND "Winners" > '1' | wikisql |
CREATE TABLE station (
station_id number,
name text,
annual_entry_exit number,
annual_interchanges number,
total_passengers number,
location text,
main_services text,
number_of_platforms number
)
CREATE TABLE train_station (
train_id number,
station_id number
)
CREATE TABLE tra... | SELECT COUNT(*) FROM train | spider |
CREATE TABLE table_13862 (
"Competition" text,
"Total" real,
"Al Ahly wins" real,
"Draws" real,
"El Zamalek wins" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which competition had 2 draws?
| SELECT "Competition" FROM table_13862 WHERE "Draws" = '2' | wikisql |
CREATE TABLE table_24363 (
"Type of Record" text,
"Attendance" real,
"Date/Year" text,
"Stadium" text,
"Result/Games" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which stadium had the result/game montreal 20 @ ottawa 10?
| SELECT "Stadium" FROM table_24363 WHERE "Result/Games" = 'Montreal 20 @ Ottawa 10' | 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 jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jyb... | css |
CREATE TABLE table_name_6 (
overall VARCHAR,
position VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the total number of overall for defensive tackle
| SELECT COUNT(overall) FROM table_name_6 WHERE position = "defensive tackle" | sql_create_context |
CREATE TABLE table_name_13 (
year INTEGER,
entrant VARCHAR,
pts VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the latest year that shadow racing team scored more than 0 points?
| SELECT MAX(year) FROM table_name_13 WHERE entrant = "shadow racing team" AND pts > 0 | 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 prescriptions... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicaid" AND diagnoses.long_title = "Congestive heart failure, unspecified" | mimicsql_data |
CREATE TABLE table_name_42 (
drawn INTEGER,
first_game VARCHAR,
played VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the total number of drawn matches from first game years before 2006 and fewer than 2 matches played?
| SELECT SUM(drawn) FROM table_name_42 WHERE first_game < 2006 AND played < 2 | sql_create_context |
CREATE TABLE table_68350 (
"Name" text,
"Park" text,
"Country" text,
"Inversions" real,
"Opened" text,
"Status" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the sum of inversions for opened of april 20, 2002
| SELECT SUM("Inversions") FROM table_68350 WHERE "Opened" = 'april 20, 2002' | wikisql |
CREATE TABLE table_1013129_2 (
college_junior_club_team VARCHAR,
nhl_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many different college/junior/club teams provided a player to the Washington Capitals NHL Team?
| SELECT COUNT(college_junior_club_team) FROM table_1013129_2 WHERE nhl_team = "Washington Capitals" | sql_create_context |
CREATE TABLE t_kc24 (
ACCOUNT_DASH_DATE time,
ACCOUNT_DASH_FLG number,
CASH_PAY number,
CIVIL_SUBSIDY number,
CKC102 number,
CLINIC_ID text,
CLINIC_SLT_DATE time,
COMP_ID text,
COM_ACC_PAY number,
COM_PAY number,
DATA_ID text,
ENT_ACC_PAY number,
ENT_PAY number,
F... | SELECT AVG(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.t_kc21_PERSON_AGE >= 22) | css |
CREATE TABLE table_name_87 (
total INTEGER,
gold VARCHAR,
bronze VARCHAR,
rank VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the largest total for a team with 1 bronze, 0 gold medals and ranking of 7?
| SELECT MAX(total) FROM table_name_87 WHERE bronze = 1 AND rank = "7" AND gold > 0 | sql_create_context |
CREATE TABLE table_41024 (
"City of license" text,
"Identifier" text,
"Frequency" text,
"Power" text,
"Class" text,
"RECNet" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Power has a CBLI Identifier?
| SELECT "Power" FROM table_41024 WHERE "Identifier" = 'cbli' | wikisql |
CREATE TABLE table_train_206 (
"id" int,
"gender" string,
"pregnancy_or_lactation" bool,
"systolic_blood_pressure_sbp" int,
"hematocrit_hct" float,
"diabetic" string,
"contraception" bool,
"diastolic_blood_pressure_dbp" int,
"serum_creatinine" float,
"NOUSE" float
)
-- Using va... | SELECT * FROM table_train_206 WHERE (hematocrit_hct > 35 AND gender = 'male') OR (hematocrit_hct > 34 AND gender = 'female') | criteria2sql |
CREATE TABLE table_name_86 (
average INTEGER,
swimsuit INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average of the contestant with a swimsuit less than 9.32?
| SELECT SUM(average) FROM table_name_86 WHERE swimsuit < 9.32 | sql_create_context |
CREATE TABLE table_74548 (
"Division" text,
"League Apps" real,
"League Goals" real,
"FA Cup Apps" real,
"FA Cup Goals" real,
"Total Apps" real,
"Total Goals" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- The total goals have a FA Cup Apps ... | SELECT COUNT("Total Goals") FROM table_74548 WHERE "FA Cup Apps" > '1' AND "Total Apps" = '37' AND "League Apps" < '30' | wikisql |
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 AVG(demographic.age) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.dob_year > "1821" | mimicsql_data |
CREATE TABLE table_25042332_30 (
enrolled_women VARCHAR,
e_vap_ratio_women VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the number of registered female voters where the percentage is 108.6%
| SELECT enrolled_women FROM table_25042332_30 WHERE e_vap_ratio_women = "108.6%" | sql_create_context |
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname var... | SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite, student_record WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.department = 'HISTART' AND COURSE_1.number... | advising |
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE i... | SELECT microlab.organism FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-15417')) AND microlab.culturesite = 'sputum, expectorated' AND DATETI... | eicu |
CREATE TABLE table_40846 (
"Rank" real,
"Name" text,
"Years" text,
"Matches" real,
"Goals" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average number of goals for players ranked above 9 and playing more than 205 matches?
| SELECT AVG("Goals") FROM table_40846 WHERE "Matches" = '205' AND "Rank" > '9' | wikisql |
CREATE TABLE table_name_40 (
producer_director VARCHAR,
film VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the Producer/Director of Fear Beneath?
| SELECT producer_director FROM table_name_40 WHERE film = "fear beneath" | sql_create_context |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TA... | SELECT COUNT(*) FROM treatment WHERE treatment.treatmentname = 'psychiatry consultation - suicide precautions' | eicu |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime... | SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%intake%' GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 4 | eicu |
CREATE TABLE table_name_96 (
total INTEGER,
finish VARCHAR,
country VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average of Fiji with t10 Finish?
| SELECT AVG(total) FROM table_name_96 WHERE finish = "t10" AND country = "fiji" | 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 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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2168" AND prescriptions.route = "INHALATION" | mimicsql_data |
CREATE TABLE mzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH text,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
KH text,
KLX number,
MJZH text,
ML number,
MZZYZDZZBM text,
MZZYZDZZMC ... | SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.... | css |
CREATE TABLE table_24736 (
"Year (Ceremony)" text,
"Film title used in nomination" text,
"Slovak title" text,
"Director" text,
"Result" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- HOw many films did martin repka category:articles with hcards dire... | SELECT COUNT("Film title used in nomination") FROM table_24736 WHERE "Director" = 'Martin Repka Category:Articles with hCards' | wikisql |
CREATE TABLE table_name_90 (
title VARCHAR,
presentation_of_credentials VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What Title has a Presentation of Credentials of October 4, 1988?
| SELECT title FROM table_name_90 WHERE presentation_of_credentials = "october 4, 1988" | sql_create_context |
CREATE TABLE jybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH text,
BGJGDM text,
BGJGMC text,
BGRGH text,
BGRQ time,
BGRXM text,
BGSJ time,
CJRQ time,
JSBBRQSJ time,
JSBBSJ time,
JYBBH text,
JYJGMC text,
JYJSGH text,
JYJSQM text,
JY... | SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb 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 = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.J... | css |
CREATE TABLE table_name_4 (
sport VARCHAR,
medal_count VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which sport has 17 as the medal count?
| SELECT sport FROM table_name_4 WHERE medal_count = 17 | sql_create_context |
CREATE TABLE table_name_24 (
top_25 INTEGER,
events INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many top-25s are associated with more than 91 events?
| SELECT SUM(top_25) FROM table_name_24 WHERE events > 91 | sql_create_context |
CREATE TABLE table_name_79 (
score VARCHAR,
game VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What's the score of Game 5?
| SELECT score FROM table_name_79 WHERE game = "5" | sql_create_context |
CREATE TABLE table_41674 (
"Poll Source" text,
"Date(s) administered" text,
"Sample size" real,
"Margin of Error" text,
"Mel Martinez (R)" text,
"Betty Castor (D)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest sample size ad... | SELECT MAX("Sample size") FROM table_41674 WHERE "Date(s) administered" = 'october 18' | wikisql |
CREATE TABLE district (
District_ID int,
District_name text,
Headquartered_City text,
City_Population real,
City_Area real
)
CREATE TABLE store_product (
Store_ID int,
Product_ID int
)
CREATE TABLE store (
Store_ID int,
Store_Name text,
Type text,
Area_size real,
Number... | SELECT Type, COUNT(*) FROM store GROUP BY Type ORDER BY COUNT(*) DESC | nvbench |
CREATE TABLE table_38089 (
"Week" real,
"Date" text,
"Opponent" text,
"Location" text,
"Time ( ET )" text,
"Result" text,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Record has a Time (ET) of 1:00pm, and an Opponent of kans... | SELECT "Record" FROM table_38089 WHERE "Time ( ET )" = '1:00pm' AND "Opponent" = 'kansas city chiefs' | wikisql |
CREATE TABLE table_79617 (
"Player" text,
"Played" real,
"Legs Won" real,
"Legs Lost" real,
"100+" real,
"140+" real,
"180s" real,
"High Checkout" real,
"3-dart Average" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the high... | SELECT SUM("High Checkout") FROM table_79617 WHERE "Legs Won" < '9' AND "180s" = '1' AND "3-dart Average" > '88.36' | wikisql |
CREATE TABLE table_name_15 (
to_par VARCHAR,
score VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What To par has a Score of 68-66=134?
| SELECT to_par FROM table_name_15 WHERE score = 68 - 66 = 134 | sql_create_context |
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0... | SELECT JOB_ID, SUM(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID | nvbench |
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minutes_distant int
)
CREATE TABLE ground_service (
city_code text,
airport_code text,
tr... | 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 = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND flight.from_airport... | atis |
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "WARF2" AND lab.fluid = "Other Body Fluid" | mimicsql_data |
CREATE TABLE table_name_12 (
year INTEGER,
team VARCHAR,
wins VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When is the earliest year associated with team norton and 0 wins?
| SELECT MIN(year) FROM table_name_12 WHERE team = "norton" AND wins < 0 | sql_create_context |
CREATE TABLE table_36593 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text,
"Attendance" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- On December 5 what team played their home game?
| SELECT "Home" FROM table_36593 WHERE "Date" = 'december 5' | wikisql |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END... | SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY AVG(MANAGER_ID) | nvbench |
CREATE TABLE table_16423 (
"Location" text,
"Monday" text,
"Tuesday" text,
"Wednesday" text,
"Thursday" text,
"Friday" text,
"Saturday" text,
"Sunday" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what's the wednesday time with monday b... | SELECT "Wednesday" FROM table_16423 WHERE "Monday" = '10:00-8:00' | wikisql |
CREATE TABLE table_7416 (
"Tournament" text,
"1995" text,
"1996" text,
"1997" text,
"1998" text,
"1999" text,
"2000" text,
"2001" text,
"2002" text,
"2003" text,
"2004" text,
"2005" text,
"2006" text
)
-- Using valid SQLite, answer the following questions for the ta... | SELECT "1997" FROM table_7416 WHERE "1998" = 'a' AND "Tournament" = 'hamburg masters' | wikisql |
CREATE TABLE table_204_731 (
id number,
"rank" number,
"athlete" text,
"shooting\nscore (pts)" text,
"fencing\nvictories (pts)" text,
"swimming\ntime (pts)" text,
"riding\npenalties (pts)" text,
"running\ntime (pts)" text,
"total" number
)
-- Using valid SQLite, answer the followin... | SELECT "athlete" FROM table_204_731 ORDER BY "total" DESC LIMIT 1 | squall |
CREATE TABLE Movie (
title VARCHAR,
mID VARCHAR
)
CREATE TABLE Rating (
mID VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the name of the movie that is rated by most of times?
| SELECT T2.title, T1.mID FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY COUNT(*) DESC LIMIT 1 | sql_create_context |
CREATE TABLE table_name_91 (
score VARCHAR,
outcome VARCHAR,
tournament VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the score of the marco island tournament match when Kathleen Horvath won runner-up?
| SELECT score FROM table_name_91 WHERE outcome = "runner-up" AND tournament = "marco island" | sql_create_context |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE vitalperiodic (
vitalperiod... | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'cultures' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year',... | eicu |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsysto... | SELECT treatment.treatmentname FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-80293' AND patient.hospitaldischargetime IS NULL)) ORDER BY t... | eicu |
CREATE TABLE table_17594659_1 (
competition VARCHAR,
opposition VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the competition of panathinaikos
| SELECT competition FROM table_17594659_1 WHERE opposition = "Panathinaikos" | sql_create_context |
CREATE TABLE fzzmzjzjlb (
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.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZ... | css |
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 BGJGDM, BGJGMC FROM jybgb WHERE BGDH = '43758538285' | css |
CREATE TABLE table_1341843_44 (
candidates VARCHAR,
incumbent VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the candidate when the incumbent was Richard C. White?
| SELECT candidates FROM table_1341843_44 WHERE incumbent = "Richard C. White" | sql_create_context |
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'amiodarone 900 mg in 500 ml d5w' AND STRFTIME('%y', medication.drugstarttime) = '2105') | eicu |
CREATE TABLE table_17340355_6 (
game VARCHAR,
team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which game was played by team milwaukee
| SELECT game FROM table_17340355_6 WHERE team = "Milwaukee" | sql_create_context |
CREATE TABLE table_40906 (
"Block" text,
"Launched" real,
"Operational" real,
"Not usable" real,
"Retired" real,
"Launch Failures" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest number of not usable satellites when there are ... | SELECT MAX("Not usable") FROM table_40906 WHERE "Launch Failures" > '0' AND "Retired" < '30' AND "Block" = 'block i' | wikisql |
CREATE TABLE classroom (
building text,
room_number text,
capacity number
)
CREATE TABLE student (
id text,
name text,
dept_name text,
tot_cred number
)
CREATE TABLE takes (
id text,
course_id text,
sec_id text,
semester text,
year number,
grade text
)
CREATE TABLE... | SELECT T2.building, T2.room_number, T2.semester, T2.year FROM course AS T1 JOIN section AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY T1.title | spider |
CREATE TABLE table_name_38 (
shots INTEGER,
points INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the lowest Shots with a Point that is larger than 32?
| SELECT MIN(shots) FROM table_name_38 WHERE points > 32 | sql_create_context |
CREATE TABLE table_name_96 (
place VARCHAR,
score VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the place of the person with a score of 67-70=137?
| SELECT place FROM table_name_96 WHERE score = 67 - 70 = 137 | sql_create_context |
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction varchar
)
CREATE TABLE student_record (
student_id int,
course_id int,
semester int,
grade varchar,
how varchar,
transfer_source varchar,
earn_credit varchar,
repeat_term varchar,
test... | SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.credits = 10 AND program_course.category LIKE 'ULCS' | advising |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.