instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
CREATE TABLE table_18217753_1 (
written_by VARCHAR,
us_viewers__millions_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who were the writers when there were 27.11 million viewers?
| SELECT written_by FROM table_18217753_1 WHERE us_viewers__millions_ = "27.11" | sql_create_context |
CREATE TABLE table_name_36 (
total INTEGER,
silver VARCHAR,
gold VARCHAR,
bronze VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the smallest total that has under 3 golds, more than 0 silvers and bronzes?
| SELECT MIN(total) FROM table_name_36 WHERE gold < 3 AND bronze > 0 AND silver > 0 | sql_create_context |
CREATE TABLE table_48920 (
"Model Number" text,
"Clock Speed" text,
"L2 Cache" text,
"FSB Speed" text,
"Voltage Range" text,
"Socket" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the Model Number which has a FSB Speed of 400 mhz?
| SELECT "Model Number" FROM table_48920 WHERE "FSB Speed" = '400 mhz' | wikisql |
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
OwnerUserId number,
Comment text,
Text text,
Title text,
Tags text,
RevisionGUID other
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnon... | SELECT A.PostId AS "post_link", B.PostId AS "post_link" FROM PostLinks AS A, PostLinks AS B, Posts AS D, Posts AS O WHERE A.PostId = D.Id AND A.RelatedPostId = B.PostId AND B.RelatedPostId = A.PostId AND A.LinkTypeId = 3 AND B.LinkTypeId = 3 AND B.PostId = O.Id AND A.PostId < B.PostId ORDER BY A.PostId | sede |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE lab (
la... | SELECT vitalperiodic.heartrate FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-31752')) AND NOT vitalperiodic.heartrate IS NULL AND ... | eicu |
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE diagnoses_icd (
... | SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'hemoglobin') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23436) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CUR... | mimic_iii |
CREATE TABLE table_48428 (
"Name" text,
"Daytime" text,
"Evening" text,
"Saturday" text,
"Sunday" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the Evening that has a Sunday of no, and a Name of s. vidal/plant express?
| SELECT "Evening" FROM table_48428 WHERE "Sunday" = 'no' AND "Name" = 's. vidal/plant express' | wikisql |
CREATE TABLE table_68686 (
"Club" text,
"Played" text,
"Drawn" text,
"Lost" text,
"Points for" text,
"Points against" text,
"Tries for" text,
"Tries against" text,
"Try bonus" text,
"Losing bonus" text,
"Points" text
)
-- Using valid SQLite, answer the following questions f... | SELECT "Drawn" FROM table_68686 WHERE "Played" = '22' AND "Points against" = '453' AND "Losing bonus" = '5' | wikisql |
CREATE TABLE table_50298 (
"Player" text,
"Nationality" text,
"Position" text,
"Years for Grizzlies" text,
"School/Club Team" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What team is from the United States and plays a guard position for the Grizz... | SELECT "School/Club Team" FROM table_50298 WHERE "Nationality" = 'united states' AND "Position" = 'guard' AND "Years for Grizzlies" = '2012' | wikisql |
CREATE TABLE VoteTypes (
Id number,
Name text
)
CREATE TABLE PostsWithDeleted (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
ViewCount number,
Body text,
OwnerUserId number,
OwnerDisplayNa... | SELECT question.Id AS "post_link", answers.CreationDate, answers.Id AS "post_link", ph.CreationDate AS Closed, answers.OwnerUserId AS "user_link", cr.Name FROM Posts AS answers INNER JOIN Posts AS question ON question.Id = answers.ParentId INNER JOIN PostHistory AS ph ON ph.PostId = question.Id INNER JOIN CloseReasonTy... | sede |
CREATE TABLE table_name_67 (
rank VARCHAR,
laps INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was Johnnie Parsons rank when he completed over 200 laps?
| SELECT rank FROM table_name_67 WHERE laps > 200 | sql_create_context |
CREATE TABLE table_name_22 (
ra___j2000__ VARCHAR,
apparent_magnitude VARCHAR,
dec___j2000__ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which R.A. (J2000) has Apparent Magnitude of 11.7, and Dec. (J2000) of 07 06 ?
| SELECT ra___j2000__ FROM table_name_22 WHERE apparent_magnitude = 11.7 AND dec___j2000__ = "°07′06″" | sql_create_context |
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25),
COUNTRY_ID varchar(2)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
... | SELECT FIRST_NAME, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY FIRST_NAME DESC | nvbench |
CREATE TABLE table_name_73 (
tally VARCHAR,
total VARCHAR,
opposition VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the tally with a total larger than 8, Waterford was the opposition?
| SELECT tally FROM table_name_73 WHERE total > 8 AND opposition = "waterford" | sql_create_context |
CREATE TABLE table_34306 (
"Date" text,
"Tournament" text,
"Winning score" text,
"Margin of victory" text,
"Runner(s)-up" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Howard Twitty was the runner-up of what tournament?
| SELECT "Tournament" FROM table_34306 WHERE "Runner(s)-up" = 'howard twitty' | wikisql |
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate n... | SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 20 AND 29) AND STRFTIME('%y', treatment.treatmenttime) = '2102' GROUP BY treatment.t... | eicu |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | SELECT demographic.gender, demographic.insurance FROM demographic WHERE demographic.subject_id = "2110" | mimicsql_data |
CREATE TABLE table_name_50 (
british_name VARCHAR,
american_name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the british name when the american name is sixteenth note?
| SELECT british_name FROM table_name_50 WHERE american_name = "sixteenth note" | sql_create_context |
CREATE TABLE table_name_13 (
react VARCHAR,
lane VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Can you tell me the total number of React that has the Lane of 5?
| SELECT COUNT(react) FROM table_name_13 WHERE lane = 5 | sql_create_context |
CREATE TABLE table_58362 (
"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 less than 3 laps and grid 15?
| SELECT "Constructor" FROM table_58362 WHERE "Laps" < '3' AND "Grid" = '15' | wikisql |
CREATE TABLE table_59503 (
"Rank" real,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Rank has a Nation of china (chn), and a Bronze smaller than 4?
| SELECT MAX("Rank") FROM table_59503 WHERE "Nation" = 'china (chn)' AND "Bronze" < '4' | wikisql |
CREATE TABLE table_name_40 (
score VARCHAR,
country VARCHAR,
player VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the Score united states of tom watson in united state?
| SELECT score FROM table_name_40 WHERE country = "united states" AND player = "tom watson" | sql_create_context |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id... | SELECT MIN(demographic.age) FROM demographic WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND demographic.diagnosis = "ANGIOEDEMA" | mimicsql_data |
CREATE TABLE table_75815 (
"Chord" text,
"Root" text,
"Major third" text,
"Perfect fifth" text,
"Minor seventh" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Major third with a Perfect fifth that is d?
| SELECT "Major third" FROM table_75815 WHERE "Perfect fifth" = 'd' | wikisql |
CREATE TABLE table_name_10 (
constellation VARCHAR,
right_ascension___j2000__ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the constellation when the Right ascension ( J2000 ) is 10h18m58.4s?
| SELECT constellation FROM table_name_10 WHERE right_ascension___j2000__ = "10h18m58.4s" | 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 procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
... | SELECT MIN(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.days_stay = "17" | mimicsql_data |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text,
first_wardid number,
last_wardid number... | SELECT admissions.marital_status FROM admissions WHERE admissions.subject_id = 808 AND admissions.dischtime IS NULL | mimic_iii |
CREATE TABLE table_52674 (
"Name" text,
"Title" text,
"Start term" real,
"End term" real,
"House" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the smallest End term with a Start term of 1913, and a Name of ludwig iii?
| SELECT MIN("End term") FROM table_52674 WHERE "Start term" = '1913' AND "Name" = 'ludwig iii' | wikisql |
CREATE TABLE table_name_17 (
date VARCHAR,
home VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- On what date was there a competition in which the home team was the Suns?
| SELECT date FROM table_name_17 WHERE home = "suns" | sql_create_context |
CREATE TABLE table_62810 (
"Rank" real,
"Athletes" text,
"Country" text,
"Time" text,
"Notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the rank for the finish time of 1:42.054?
| SELECT AVG("Rank") FROM table_62810 WHERE "Time" = '1:42.054' | wikisql |
CREATE TABLE table_name_98 (
year INTEGER,
venue VARCHAR,
event VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the earliest year that an event held in Berlin, Germany had a 100 m hurdles event?
| SELECT MIN(year) FROM table_name_98 WHERE venue = "berlin, germany" AND event = "100 m hurdles" | sql_create_context |
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime t... | SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-2 year') GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 4 | mimic_iii |
CREATE TABLE table_51877 (
"D 41" text,
"D 42" text,
"D 43" text,
"D 44" text,
"D 45" text,
"D 46" text,
"R 54" text,
"R 53" text,
"R 52" text,
"R 51" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the D 41 which has a D 43 ... | SELECT "D 41" FROM table_51877 WHERE "D 43" = 'r 18' | wikisql |
CREATE TABLE table_25236 (
"Title" text,
"Language" text,
"Country" text,
"Years published" text,
"Frequency" text,
"Medium" text,
"Classification" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What classifications does Fish Rap live! has?
| SELECT "Classification" FROM table_25236 WHERE "Title" = 'Fish Rap Live!' | wikisql |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
sy... | SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-31704')) AND medication.drugname = 'ondansetron 2 mg/1 ml ... | eicu |
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 COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.ethnicity = "WHITE" | mimicsql_data |
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 transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
... | SELECT SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 728 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND prescriptions.drug = 'metoprolol' | mimic_iii |
CREATE TABLE table_47670 (
"Res." text,
"Record" text,
"Opponent" text,
"Method" text,
"Round" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What record has decision (majority) as the method?
| SELECT "Record" FROM table_47670 WHERE "Method" = 'decision (majority)' | wikisql |
CREATE TABLE table_name_48 (
results VARCHAR,
first_elected INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the results of a first elected prior to year 1982?
| SELECT results FROM table_name_48 WHERE first_elected < 1982 | sql_create_context |
CREATE TABLE table_70094 (
"Value" text,
"Khmer" real,
"Word Form" text,
"UNGEGN" text,
"ALA-LC" text,
"Notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Value, when the Notes are literally 'one hundred million'?
| SELECT "Value" FROM table_70094 WHERE "Notes" = 'literally "one hundred million' | wikisql |
CREATE TABLE table_7604 (
"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.
-- When has a Score of 0 0, and a Away team of scunthorpe united?
| SELECT "Date" FROM table_7604 WHERE "Score" = '0–0' AND "Away team" = 'scunthorpe united' | 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 = '0616625' AND NOT mzjzjlb.JZKSMC LIKE '%病理科%' | css |
CREATE TABLE table_27536 (
"Round" text,
"Circuit" text,
"Date" text,
"Pole Position" text,
"Fastest Lap" text,
"Winning driver" text,
"Winning team" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the fastest lap for round 3
| SELECT "Fastest Lap" FROM table_27536 WHERE "Round" = '3' | wikisql |
CREATE TABLE table_name_85 (
last_5_meetings VARCHAR,
current_streak VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the result of the last 5 meetings for a team with an L 1 streak?
| SELECT last_5_meetings FROM table_name_85 WHERE current_streak = "l 1" | sql_create_context |
CREATE TABLE table_name_10 (
in_service_for_nal VARCHAR,
ship VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- The ship MS Vistafjord has what in service for NAL?
| SELECT in_service_for_nal FROM table_name_10 WHERE ship = "ms vistafjord" | 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 demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Private" AND demographic.dob_year < "2146" | mimicsql_data |
CREATE TABLE table_name_60 (
school VARCHAR,
location VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the school when the location is rochester?
| SELECT school FROM table_name_60 WHERE location = "rochester" | sql_create_context |
CREATE TABLE Dorm_amenity (
amenid INTEGER,
amenity_name VARCHAR(25)
)
CREATE TABLE Dorm (
dormid INTEGER,
dorm_name VARCHAR(20),
student_capacity INTEGER,
gender VARCHAR(1)
)
CREATE TABLE Has_amenity (
dormid INTEGER,
amenid INTEGER
)
CREATE TABLE Lives_in (
stuid INTEGER,
do... | SELECT gender, SUM(student_capacity) FROM Dorm GROUP BY gender | nvbench |
CREATE TABLE table_204_174 (
id number,
"rank" number,
"name" text,
"nationality" text,
"result" number,
"notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- who scored more than liliya dusmetova but less than lee young sun ?
| SELECT "name" FROM table_204_174 WHERE "result" > (SELECT "result" FROM table_204_174 WHERE "name" = 'liliya dusmetova') AND "result" < (SELECT "result" FROM table_204_174 WHERE "name" = 'lee young-sun') | squall |
CREATE TABLE table_18600760_7 (
land___sqmi__ VARCHAR,
water__sqmi_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- If the water square milage is 1.701, what is the land square milage?
| SELECT land___sqmi__ FROM table_18600760_7 WHERE water__sqmi_ = "1.701" | sql_create_context |
CREATE TABLE table_name_82 (
runner_up VARCHAR,
year VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the runner-up in 2004?
| SELECT runner_up FROM table_name_82 WHERE year = 2004 | sql_create_context |
CREATE TABLE table_51962 (
"Train No." text,
"Train Name" text,
"Origin" text,
"Destination" text,
"Frequency" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the frequency of the train to Bangalore?
| SELECT "Frequency" FROM table_51962 WHERE "Destination" = 'bangalore' | wikisql |
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE prescriptio... | SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 77676) AND DATETIME(procedures_icd.charttime) <= DATETIME(CURRENT_TIME(), '-1 year') | mimic_iii |
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.JZZDBM, mzjzjlb.JZZDSM FROM person_info JOIN hz_info JOIN mzjzjlb JOIN person_info_hz_info ON person_info.RYBH = person_info_hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND person_info_hz_info.KH = hz_info.KH AND person_info_hz_info.KLX = hz_... | css |
CREATE TABLE job_history (
employee_id number,
start_date time,
end_date time,
job_id text,
department_id number
)
CREATE TABLE locations (
location_id number,
street_address text,
postal_code text,
city text,
state_province text,
country_id text
)
CREATE TABLE departments ... | SELECT * FROM employees WHERE NOT employee_id IN (SELECT employee_id FROM job_history) | spider |
CREATE TABLE table_train_186 (
"id" int,
"language" string,
"diabetic" string,
"regular_alcohol_intake" int,
"allergy_to_drug" bool,
"alcohol_abuse" bool,
"age" float,
"NOUSE" float
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- diagnosis of ... | SELECT * FROM table_train_186 WHERE diabetic = 'i' | criteria2sql |
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 int,
capacity int,
pay_load int,
cruising_speed int,
range_... | 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, flight_stop WHERE ((flight.flight_id = flight_stop.flight_id AND flight.stops >= 1) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS'... | atis |
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code te... | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT microbiologyevents.hadm_id FROM microbiologyevents WHERE microbiologyevents.spec_type_desc = 'foot culture' AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) | mimic_iii |
CREATE TABLE table_name_36 (
venue VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Where was the game held that was played on 2002-03-07?
| SELECT venue FROM table_name_36 WHERE date = "2002-03-07" | sql_create_context |
CREATE TABLE table_27268238_4 (
highest_score VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- If the highest score is 88, what are the 50s?
| SELECT 50 AS s FROM table_27268238_4 WHERE highest_score = "88" | sql_create_context |
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.long_title = "Transfusion of other serum" | mimicsql_data |
CREATE TABLE table_35719 (
"Rocket" text,
"Country" text,
"Family" text,
"Launches" real,
"Successes" real,
"Failures" real,
"Partial failures" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the least amount of failures with 1 launch... | SELECT MIN("Failures") FROM table_35719 WHERE "Launches" = '1' AND "Partial failures" < '0' | wikisql |
CREATE TABLE trip (
id INTEGER,
duration INTEGER,
start_date TEXT,
start_station_name TEXT,
start_station_id INTEGER,
end_date TEXT,
end_station_name TEXT,
end_station_id INTEGER,
bike_id INTEGER,
subscription_type TEXT,
zip_code INTEGER
)
CREATE TABLE weather (
date TEX... | SELECT long, COUNT(long) FROM station ORDER BY COUNT(long) DESC | nvbench |
CREATE TABLE wine (
no number,
grape text,
winery text,
appelation text,
state text,
name text,
year number,
price number,
score number,
cases number,
drink text
)
CREATE TABLE appellations (
no number,
appelation text,
county text,
state text,
area text,... | SELECT COUNT(*), grape FROM wine GROUP BY grape | spider |
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 procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
... | SELECT demographic.admission_type, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "22999" | mimicsql_data |
CREATE TABLE table_name_38 (
away_team VARCHAR,
home_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the score for the away team when the home team was Fitzroy?
| SELECT away_team AS score FROM table_name_38 WHERE home_team = "fitzroy" | sql_create_context |
CREATE TABLE table_name_57 (
date VARCHAR,
away_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- If the Away team was south melbourne what Date did they play?
| SELECT date FROM table_name_57 WHERE away_team = "south melbourne" | sql_create_context |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
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... | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 83182 AND admissions.dischtime IS NULL) AND transfers.careunit = 'csru' ORDER BY transfers.intime DESC LIMIT 1 | mimic_iii |
CREATE TABLE Students (
student_id INTEGER,
date_of_registration DATETIME,
date_of_latest_logon DATETIME,
login_name VARCHAR(40),
password VARCHAR(10),
personal_name VARCHAR(40),
middle_name VARCHAR(40),
family_name VARCHAR(40)
)
CREATE TABLE Subjects (
subject_id INTEGER,
subje... | SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment | nvbench |
CREATE TABLE table_name_20 (
city_of_license VARCHAR,
call_sign VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which city of license has the Kyli call sign?
| SELECT city_of_license FROM table_name_20 WHERE call_sign = "kyli" | sql_create_context |
CREATE TABLE t_kc24 (
MED_SAFE_PAY_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
MED_CLINIC_ID text,
REF_SLT_FLG number,
CLINIC_SLT_DATE time,
COMP_ID text,
PERSON_ID text,
FLX_MED_ORG_ID text,
INSU_TYPE text,
MED_AMOUT number,
PER_ACC_PAY number,
OVE_PAY numb... | SELECT AVG(MED_AMOUT) FROM t_kc21 WHERE MED_ORG_DEPT_NM = '中医针灸科' AND IN_HOSP_DATE BETWEEN '2005-06-25' AND '2011-05-19' AND IN_DIAG_DIS_NM = '脑梗死后遗症' AND CLINIC_TYPE = '住院' | css |
CREATE TABLE Properties (
property_id INTEGER,
property_type_code CHAR(15),
property_address VARCHAR(255),
other_details VARCHAR(255)
)
CREATE TABLE Organizations (
organization_id INTEGER,
parent_organization_id INTEGER,
organization_details VARCHAR(255)
)
CREATE TABLE Customer_Event_Note... | SELECT date_moved_in, COUNT(date_moved_in) FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id ORDER BY COUNT(date_moved_in) DESC | nvbench |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE cost (
costid number,
u... | SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-66442')) AND medication.drugname = '30 ml cup : alum & mag hydroxide-s... | eicu |
CREATE TABLE table_name_98 (
draws INTEGER,
ntfa_div_2 VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the lowest number of draws of the NTFA Div 2 Lilydale?
| SELECT MIN(draws) FROM table_name_98 WHERE ntfa_div_2 = "lilydale" | sql_create_context |
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location text,
insurance text,
language text,
marital_status text,
ethnicity text,
age number
)
CREATE ... | SELECT AVG(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 = 19175)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arte... | mimic_iii |
CREATE TABLE Accounts (
account_id INTEGER,
customer_id INTEGER,
date_account_opened DATETIME,
account_name VARCHAR(50),
other_account_details VARCHAR(255)
)
CREATE TABLE Orders (
order_id INTEGER,
customer_id INTEGER,
date_order_placed DATETIME,
order_details VARCHAR(255)
)
CREATE... | SELECT product_id, COUNT(DISTINCT order_id) FROM Order_Items | nvbench |
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
... | SELECT u.Id AS "user_link", AVG(a.NormalizedScore) AS AvgNormalizedScore FROM Users AS u JOIN (SELECT (CAST(a.Score AS FLOAT) / SUM(allA.Score)) * 100 AS NormalizedScore, a.Id, a.OwnerUserId FROM Posts AS a JOIN Posts AS q ON a.ParentId = q.Id JOIN Posts AS allA ON allA.ParentId = q.Id WHERE a.PostTypeId = 2 AND a.Scor... | sede |
CREATE TABLE table_49680 (
"Driver" text,
"Team" text,
"Laps" real,
"Time/Retired" text,
"Grid" real,
"Points" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What were S bastien Bourdais' lowest points when there were less than 63 laps?
| SELECT MIN("Points") FROM table_49680 WHERE "Driver" = 'sébastien bourdais' AND "Laps" < '63' | wikisql |
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate n... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE NOT patient.hospitaldischargetime IS NULL AND STRFTIME('%y', patient.hospitaldischargetime) <= '2100' | eicu |
CREATE TABLE table_65289 (
"Lok Sabha" text,
"Duration" text,
"Name of M.P." text,
"Party Affiliation" text,
"Election Year" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Lok Sabha for Dravida Munnetra Kazhagam, in 1999-04?
| SELECT "Lok Sabha" FROM table_65289 WHERE "Party Affiliation" = 'dravida munnetra kazhagam' AND "Duration" = '1999-04' | wikisql |
CREATE TABLE table_65667 (
"Name" text,
"Gain" real,
"Loss" real,
"Long" real,
"Avg/G" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average long that has 1581 as a gain, with a loss less than 308?
| SELECT AVG("Long") FROM table_65667 WHERE "Gain" = '1581' AND "Loss" < '308' | wikisql |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE labevents (
row_id number,
subject_id number,
... | SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'creat esophagastr sphinc')) AND STRFTIME('%y', cost.charg... | mimic_iii |
CREATE TABLE orders (
order_id number,
customer_id number,
order_status text,
date_order_placed time,
order_details text
)
CREATE TABLE shipments (
shipment_id number,
order_id number,
invoice_number number,
shipment_tracking_number text,
shipment_date time,
other_shipment_d... | SELECT order_id FROM orders ORDER BY date_order_placed DESC LIMIT 1 | spider |
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location text,
insurance text,
language text,
marital_status text,
ethnicity text,
age number
)
CREATE ... | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ... | mimic_iii |
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 t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'cisatracurium' AND DATETIME(medication.drugstarttim... | eicu |
CREATE TABLE table_name_10 (
constructor VARCHAR,
driver VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Tell me the constructor for david coulthard
| SELECT constructor FROM table_name_10 WHERE driver = "david coulthard" | sql_create_context |
CREATE TABLE constructorresults (
constructorresultsid number,
raceid number,
constructorid number,
points number,
status number
)
CREATE TABLE circuits (
circuitid number,
circuitref text,
name text,
location text,
country text,
lat number,
lng number,
alt number,
... | SELECT name FROM races ORDER BY date DESC LIMIT 1 | spider |
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 diagnoses.short_title = "Stomatits & mucosits NEC" | mimicsql_data |
CREATE TABLE table_name_10 (
chosen_by VARCHAR,
couple VARCHAR,
choreographer_s_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Chosen By, when Couple is Katee Shean Joshua Allen, and when Choreographer(s) is Nakul Dev Mahajan?
| SELECT chosen_by FROM table_name_10 WHERE couple = "katee shean joshua allen" AND choreographer_s_ = "nakul dev mahajan" | sql_create_context |
CREATE TABLE entrepreneur (
Entrepreneur_ID int,
People_ID int,
Company text,
Money_Requested real,
Investor text
)
CREATE TABLE people (
People_ID int,
Name text,
Height real,
Weight real,
Date_of_Birth text
)
-- Using valid SQLite, answer the following questions for the tabl... | SELECT Investor, COUNT(Investor) FROM entrepreneur GROUP BY Investor ORDER BY COUNT(Investor) DESC | nvbench |
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 employees (
EMPLOYEE_ID decimal(6,0),... | SELECT JOB_ID, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(SALARY) DESC | nvbench |
CREATE TABLE table_name_11 (
lost VARCHAR,
points_for VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Lost, when Points For is '257'?
| SELECT lost FROM table_name_11 WHERE points_for = "257" | sql_create_context |
CREATE TABLE Rating (
rID int,
mID int,
stars int,
ratingDate date
)
CREATE TABLE Movie (
mID int,
title text,
year int,
director text
)
CREATE TABLE Reviewer (
rID int,
name text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What ... | SELECT name, AVG(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name ORDER BY name | nvbench |
CREATE TABLE table_28584 (
"District" text,
"Incumbent" text,
"Party" text,
"Elected" real,
"Status" text,
"Result" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the status in the district with the incumbent Bob Barr?
| SELECT "Status" FROM table_28584 WHERE "Incumbent" = 'Bob Barr' | wikisql |
CREATE TABLE table_name_89 (
matches VARCHAR,
rank VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Can you tell me the Matches that has the Rank of 1?
| SELECT matches FROM table_name_89 WHERE rank = 1 | sql_create_context |
CREATE TABLE table_name_27 (
directed_by VARCHAR,
original_air_date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Directed by has an Original air date of april 29, 2000?
| SELECT directed_by FROM table_name_27 WHERE original_air_date = "april 29, 2000" | sql_create_context |
CREATE TABLE hz_info (
KH text,
KLX number,
YLJGDM text,
RYBH text
)
CREATE TABLE zyjzjlb (
YLJGDM text,
JZLSH text,
MZJZLSH text,
KH text,
KLX number,
HZXM text,
WDBZ number,
RYDJSJ time,
RYTJDM number,
RYTJMC text,
JZKSDM text,
JZKSMC text,
RZBQDM t... | SELECT BGDH FROM jyjgzbb WHERE JYZBLSH = '94916575110' | css |
CREATE TABLE table_name_74 (
total VARCHAR,
gold VARCHAR,
silver VARCHAR,
bronze VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- I want to know the total for silver more than 0 with bronze more than 21 and gold more than 29
| SELECT COUNT(total) FROM table_name_74 WHERE silver > 0 AND bronze > 21 AND gold > 29 | sql_create_context |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE microlab (
microlabid number,
... | SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'aspirin 81 mg po chew')) AND STRFTIME('%y', co... | eicu |
CREATE TABLE t_kc22 (
MED_EXP_DET_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
MED_CLINIC_ID text,
MED_EXP_BILL_ID text,
SOC_SRT_DIRE_CD text,
SOC_SRT_DIRE_NM text,
DIRE_TYPE number,
CHA_ITEM_LEV number,
MED_INV_ITEM_TYPE text,
MED_DIRE_CD text,
MED_DIRE_NM text,... | SELECT AVG(MED_AMOUT) FROM t_kc24 WHERE MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_AGE >= 9) | css |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.