instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
CREATE TABLE premises (
premises_type VARCHAR,
premise_id VARCHAR
)
CREATE TABLE customer_addresses (
address_type_code VARCHAR,
premise_id VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Show the premise type and address type code for all customer a... | SELECT T2.premises_type, T1.address_type_code FROM customer_addresses AS T1 JOIN premises AS T2 ON T1.premise_id = T2.premise_id | sql_create_context |
CREATE TABLE compartment_class (
compartment varchar,
class_type varchar
)
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
dual_airline varchar,
service_name text
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varch... | 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 = 'MILWAUKEE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHO... | atis |
CREATE TABLE table_name_37 (
nationality VARCHAR,
games VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the nationality of the player who played 505 games?
| SELECT nationality FROM table_name_37 WHERE games = "505" | sql_create_context |
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 ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE LOWER('%##country##%') ORDER BY Reputation DESC | sede |
CREATE TABLE table_name_87 (
label VARCHAR,
catalog VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Label of the release with Catalog number LPM-2899?
| SELECT label FROM table_name_87 WHERE catalog = "lpm-2899" | sql_create_context |
CREATE TABLE table_13643154_2 (
rnd INTEGER,
circuit VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the most rnd for watkins glen?
| SELECT MIN(rnd) FROM table_13643154_2 WHERE circuit = "Watkins Glen" | sql_create_context |
CREATE TABLE table_73839 (
"No. in season" real,
"No. in series" real,
"Title" text,
"Canadian airdate" text,
"US airdate" text,
"Production code" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many titles had production code 1040?
| SELECT COUNT("Title") FROM table_73839 WHERE "Production code" = '1040' | wikisql |
CREATE TABLE table_50991 (
"Heat" real,
"Lane" real,
"Name" text,
"Country" text,
"Mark" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest lane value for a mark of 2:02.27 NR, with heats under 2?
| SELECT MAX("Lane") FROM table_50991 WHERE "Mark" = '2:02.27 nr' AND "Heat" < '2' | wikisql |
CREATE TABLE climber (
Climber_ID int,
Name text,
Country text,
Time text,
Points real,
Mountain_ID int
)
CREATE TABLE mountain (
Mountain_ID int,
Name text,
Height real,
Prominence real,
Range text,
Country text
)
-- Using valid SQLite, answer the following questions ... | SELECT T1.Name, T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID ORDER BY T1.Name | nvbench |
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 procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime t... | SELECT MIN(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 22648) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'urea nitrogen, urine') AND DATETIME(labevents.charttime, 'start of month') ... | mimic_iii |
CREATE TABLE table_28190363_1 (
network VARCHAR,
judges VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many networks are there that include the judges pete goffe-wood andrew atkinson benny masekwameng?
| SELECT COUNT(network) FROM table_28190363_1 WHERE judges = "Pete Goffe-Wood Andrew Atkinson Benny Masekwameng" | 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 inputevents_cv (
row_id number,
subject_id number,
hadm_id numbe... | SELECT chartevents.charttime FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18866) AND icustays.outtime IS NULL) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WH... | mimic_iii |
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 = "SDH" AND demographic.days_stay > "10" | mimicsql_data |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | SELECT DATEADD(mm, (YEAR(Posts.CreationDate) - 1900) * 12 + MONTH(Posts.CreationDate) - 1, 0) AS Month, Tags.TagName, COUNT(*) AS Questions FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Tags.TagName IN ... | sede |
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE patient (
uniquep... | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'syringomyelia')... | eicu |
CREATE TABLE table_23289 (
"Draw" real,
"Artist" text,
"Song" text,
"Jury votes" real,
"Televotes" real,
"Total votes" real,
"Result" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many televotes are there where there is 4 jury votes?
| SELECT "Televotes" FROM table_23289 WHERE "Jury votes" = '4' | wikisql |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE PostFeedback (
Id nu... | SELECT AVG(Q.Score) AS QuestionScore, AVG(A.Score) AS AnswerScore, AVG(A.Score) + STDEV(A.Score) AS PlusOneSigma, AVG(A.Score) - STDEV(A.Score) AS MinusOneSigma FROM Posts AS A INNER JOIN Posts AS Q ON A.ParentId = Q.Id WHERE A.PostTypeId = 2 AND Q.Score <= 100 GROUP BY SIGN(Q.Score) * ROUND(SQRT(ABS(Q.Score) * 10), 0)... | sede |
CREATE TABLE table_73493 (
"Outcome" text,
"Year" real,
"Championship" text,
"Surface" text,
"Opponent in the final" text,
"Score in the final" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the total number of opponent in the final for 6 2... | SELECT COUNT("Opponent in the final") FROM table_73493 WHERE "Score in the final" = '6–2, 6–1, 6–3' | wikisql |
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 (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 = 28443) AND icustays.outtime IS NULL) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_i... | mimic_iii |
CREATE TABLE mzjzjlb (
YLJGDM text,
JZLSH text,
KH text,
KLX number,
MJZH text,
HZXM text,
NLS number,
NLY number,
ZSEBZ number,
JZZTDM number,
JZZTMC text,
JZJSSJ time,
TXBZ number,
ZZBZ number,
WDBZ number,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
... | SELECT mzjzjlb.JZZDBM, mzjzjlb.JZZDSM 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 = '秦承平' | css |
CREATE TABLE table_name_58 (
location VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the location on november 23?
| SELECT location FROM table_name_58 WHERE date = "november 23" | sql_create_context |
CREATE TABLE table_56668 (
"Year" text,
"Start" text,
"Qual" text,
"Rank" text,
"Finish" text,
"Laps" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which finish has a 99.550 Qual?
| SELECT "Finish" FROM table_56668 WHERE "Qual" = '99.550' | wikisql |
CREATE TABLE table_12574 (
"Opposing Teams" text,
"Against" real,
"Date" text,
"Venue" text,
"Status" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the date when France is the opposing team?
| SELECT "Date" FROM table_12574 WHERE "Opposing Teams" = 'france' | wikisql |
CREATE TABLE table_name_70 (
rating VARCHAR,
share VARCHAR,
viewers__millions_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- WHAT IS THE RATING THAT HAD A SHARE SMALLER THAN 4, AND 2.47 MILLION VIEWERS?
| SELECT COUNT(rating) FROM table_name_70 WHERE share < 4 AND viewers__millions_ > 2.47 | sql_create_context |
CREATE TABLE table_204_123 (
id number,
"week" number,
"date" text,
"kickoff" text,
"opponent" text,
"results\nfinal score" text,
"results\nteam record" text,
"game site" text,
"attendance" number
)
-- Using valid SQLite, answer the following questions for the tables provided above... | SELECT "week" FROM table_204_123 WHERE "week" <> 6 AND "kickoff" = (SELECT "kickoff" FROM table_204_123 WHERE "week" = 6) | squall |
CREATE TABLE table_28400 (
"Institution" text,
"Location" text,
"Nickname" text,
"Founded" real,
"Founding Religious Affiliation" text,
"Enrollment" real,
"Joined" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When did the institution locat... | SELECT "Joined" FROM table_28400 WHERE "Location" = 'Lewiston, Maine' | wikisql |
CREATE TABLE table_7326 (
"Country or region" text,
"Number of mobile phones" text,
"Population" text,
"# of phones as % of population" real,
"Last updated date" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many people live where there are 118... | SELECT "Population" FROM table_7326 WHERE "# of phones as % of population" = '118' | wikisql |
CREATE TABLE flight (
aircraft_code_sequence text,
airline_code varchar,
airline_flight text,
arrival_time int,
connections int,
departure_time int,
dual_carrier text,
flight_days text,
flight_id int,
flight_number int,
from_airport varchar,
meal_code text,
stops int,... | SELECT DISTINCT flight_id FROM flight WHERE (((flight_days IN (SELECT DAYSalias1.days_code FROM days AS DAYSalias1 WHERE DAYSalias1.day_name IN (SELECT DATE_DAYalias1.day_name FROM date_day AS DATE_DAYalias1 WHERE DATE_DAYalias1.day_number = 23 AND DATE_DAYalias1.month_number = 4 AND DATE_DAYalias1.year = 1991)) AND to... | atis |
CREATE TABLE table_54949 (
"Class" text,
"Wheel arrangement" text,
"Fleet number(s)" text,
"Manufacturer" text,
"Year made" text,
"Quantity made" text,
"Quantity preserved" text,
"Year(s) withdrawn" text
)
-- Using valid SQLite, answer the following questions for the tables provided ab... | SELECT "Class" FROM table_54949 WHERE "Manufacturer" = 'eastleigh works' AND "Year made" = '1914' AND "Year(s) withdrawn" = '1959' | wikisql |
CREATE TABLE table_65623 (
"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.
-- What date was the circuit, snetterton, when riki christodoulou... | SELECT "Date" FROM table_65623 WHERE "Circuit" = 'snetterton' AND "Fastest Lap" = 'riki christodoulou' | wikisql |
CREATE TABLE table_name_5 (
laps VARCHAR,
driver VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the number of laps when the driver is ron flockhart?
| SELECT COUNT(laps) FROM table_name_5 WHERE driver = "ron flockhart" | sql_create_context |
CREATE TABLE table_12962773_2 (
no VARCHAR,
current_club VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the numbers of the players currently playing for Ironi Nahariya?
| SELECT no FROM table_12962773_2 WHERE current_club = "Ironi Nahariya" | sql_create_context |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2117" AND lab.itemid = "51176" | mimicsql_data |
CREATE TABLE table_1965650_11 (
nhl_team VARCHAR,
college_junior_club_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What NHL team was the player from Calgary Centennials (WCHL) drafted for?
| SELECT nhl_team FROM table_1965650_11 WHERE college_junior_club_team = "Calgary Centennials (WCHL)" | 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 wdmzjzjlb.JLSJ FROM wdmzjzjlb WHERE wdmzjzjlb.JZLSH = '15752379757' UNION SELECT bdmzjzjlb.JLSJ FROM bdmzjzjlb WHERE bdmzjzjlb.JZLSH = '15752379757' | css |
CREATE TABLE table_43300 (
"Name" text,
"Years" text,
"League a" text,
"FA Cup" text,
"League Cup" text,
"Other b" text,
"Total" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What shows for the League when the FA Cup is 6 (20)?
| SELECT "League a" FROM table_43300 WHERE "FA Cup" = '6 (20)' | wikisql |
CREATE TABLE table_20335 (
"Season #" real,
"Series #" real,
"Title" text,
"Director(s)" text,
"Writer(s)" text,
"Original airdate" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the most series number for giula sandler
| SELECT MAX("Series #") FROM table_20335 WHERE "Writer(s)" = 'Giula Sandler' | wikisql |
CREATE TABLE table_73842 (
"Series #" real,
"Season #" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" text,
"U.S. viewers (million)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- W... | SELECT "Title" FROM table_73842 WHERE "U.S. viewers (million)" = '2.75' | wikisql |
CREATE TABLE table_2417330_3 (
date_of_successors_formal_installation VARCHAR,
successor VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When did Orville H. Browning (r) succeed?
| SELECT date_of_successors_formal_installation FROM table_2417330_3 WHERE successor = "Orville H. Browning (R)" | sql_create_context |
CREATE TABLE Ref_Transaction_Types (
transaction_type_code VARCHAR(10),
transaction_type_description VARCHAR(80)
)
CREATE TABLE Sales (
sales_transaction_id INTEGER,
sales_details VARCHAR(255)
)
CREATE TABLE Transactions (
transaction_id INTEGER,
investor_id INTEGER,
transaction_type_code ... | SELECT date_of_transaction, COUNT(date_of_transaction) FROM Transactions ORDER BY COUNT(date_of_transaction) DESC | nvbench |
CREATE TABLE table_80432 (
"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 "Tries against" FROM table_80432 WHERE "Drawn" = '1' AND "Points" = '41' | wikisql |
CREATE TABLE table_44336 (
"Edition" text,
"Round" text,
"Date" text,
"Partnering" text,
"Against" text,
"Surface" text,
"Opponents" text,
"Result" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who were the opponents during the 2006 fed... | SELECT "Opponents" FROM table_44336 WHERE "Edition" = '2006 fed cup europe/africa group ii' AND "Against" = 'greece' | wikisql |
CREATE TABLE table_79567 (
"Rank" real,
"Athletes" text,
"Country" text,
"Time" text,
"Notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the notes for the athlete from Spain?
| SELECT "Notes" FROM table_79567 WHERE "Country" = 'spain' | wikisql |
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
a... | SELECT COUNT(*) > 0 FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15794)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'e24 with... | mimic_iii |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TA... | 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 = '027-153669' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospital... | eicu |
CREATE TABLE table_name_16 (
position INTEGER,
bike_no VARCHAR,
points VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average Position, when Bike No is greater than 8, and when Points is less than 240?
| SELECT AVG(position) FROM table_name_16 WHERE bike_no > 8 AND points < 240 | sql_create_context |
CREATE TABLE table_15977768_1 (
centennial VARCHAR,
information VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the centennial for location
| SELECT centennial FROM table_15977768_1 WHERE information = "Location" | sql_create_context |
CREATE TABLE table_17235 (
"Disc" real,
"Track" real,
"English title" text,
"Japanese title" text,
"R\u014dmaji title" text,
"Artist" text,
"Track time" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How long is track number 8?
| SELECT "Track time" FROM table_17235 WHERE "Track" = '8' | wikisql |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE microlab (
microlabid number,
... | 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 = '016-9636')) AND lab.labname = 'sodium' AND DATETIME(lab.labresulttime, 'start of mo... | eicu |
CREATE TABLE table_name_39 (
rank VARCHAR,
notes VARCHAR,
name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What's the rank for Daewoo Business Center when the notes are cancelled?
| SELECT rank FROM table_name_39 WHERE notes = "cancelled" AND name = "daewoo business center" | sql_create_context |
CREATE TABLE table_name_18 (
year VARCHAR,
rank INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What year ranked larger than 5?
| SELECT year FROM table_name_18 WHERE rank > 5 | sql_create_context |
CREATE TABLE documents (
document_id number,
document_type_code text,
project_id number,
document_date time,
document_name text,
document_description text,
other_details text
)
CREATE TABLE documents_with_expenses (
document_id number,
budget_type_code text,
document_details tex... | SELECT project_id, COUNT(*) FROM documents GROUP BY project_id | spider |
CREATE TABLE table_7096 (
"million CZK" text,
"2005" text,
"2006" real,
"2007" real,
"2008" real,
"2009" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the sum of 2007 when the 2009 is less than 7,006, and a 2008 larger than 2,226?
| SELECT SUM("2007") FROM table_7096 WHERE "2009" < '7,006' AND "2008" > '2,226' | 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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "E8859" AND prescriptions.drug_type = "ADDITIVE" | mimicsql_data |
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate time
)
CREATE TABLE ReviewRejectionReasons (
Id number,
N... | SELECT t.TagName, t.Count FROM Tags AS t ORDER BY t.Count DESC | sede |
CREATE TABLE table_37731 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" real,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the record after the game in which Rosales (1-1) took the loss?
| SELECT "Record" FROM table_37731 WHERE "Loss" = 'rosales (1-1)' | wikisql |
CREATE TABLE table_37595 (
"Rank" real,
"Club" text,
"Wins" real,
"Last win" real,
"Runner-up" real,
"Last losing final" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many Last wins have a Club of mansfield town, and Wins smaller than 1?
| SELECT COUNT("Last win") FROM table_37595 WHERE "Club" = 'mansfield town' AND "Wins" < '1' | wikisql |
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate ti... | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, 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 = admissi... | mimic_iii |
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total... | SELECT COUNT(*) > 0 FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course_offering.section_number = 825 AND course.department = 'GREEK' AND course.number = 441 AND semester.semester = 'Winter' AND semest... | advising |
CREATE TABLE PersonFriend (
name VARCHAR,
friend VARCHAR
)
CREATE TABLE Person (
name VARCHAR,
age INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Find the name of the person who has friends with age above 40 and under age 30?
| SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age > 40) INTERSECT SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age < 30) | sql_create_context |
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 * FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE hz_info.RYBH = '00758065' AND hz_info.YLJGDM = '2859179' AND zyjzjlb.CYKSMC LIKE '%眼外伤%' | css |
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
HZXM text,
JZKSDM text,
JZKSMC text,
JZLSH text,
KH text,
KLX number,
MZBMLX number,
MZJZLSH text,
MZZDBM text,
MZZDMC text,
MZZYZDZZBM... | SELECT * 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.BGDH = jyjgzbb.BGDH WHERE hz_i... | css |
CREATE TABLE table_name_29 (
goals INTEGER,
games VARCHAR,
debut_year VARCHAR,
player VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the most goals listed when Jack Trehey was the player, with the listed debut year of 1902, games less than 1... | SELECT MAX(goals) FROM table_name_29 WHERE debut_year = 1902 AND player = "jack trehey" AND games < 1 | sql_create_context |
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE PostLinks (
Id num... | SELECT LOG(10, CAST((JULIANDAY(CreationDate) - JULIANDAY(q.CreationDate)) * 1440.0 AS INT)) AS "Log Time (m)", LOG(10, COUNT(*)) FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id LEFT OUTER JOIN Posts AS a2 ON a.ParentId = a2.ParentId AND a.CreationDate > a2.CreationDate WHERE a2.Id IS NULL AND a.CreationDate ... | sede |
CREATE TABLE table_25946 (
"Game" real,
"Date" text,
"Opponent" text,
"Score" text,
"Location" text,
"Attendance" real,
"Record" text,
"Points" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many opponents were there with the record ... | SELECT COUNT("Opponent") FROM table_25946 WHERE "Record" = '3-2-2' | wikisql |
CREATE TABLE table_name_51 (
record VARCHAR,
attendance VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which record has 64,053 as the attendance?
| SELECT record FROM table_name_51 WHERE attendance = "64,053" | sql_create_context |
CREATE TABLE table_name_75 (
venue VARCHAR,
rank VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What venue has 2 as the rank?
| SELECT venue FROM table_name_75 WHERE rank = "2" | sql_create_context |
CREATE TABLE table_64326 (
"Season" text,
"Date" text,
"Venue" text,
"Competition" text,
"Score" text,
"Attendance" real,
"Report" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many people attended the Scottish Cup on 29.02.2000?
| SELECT "Attendance" FROM table_64326 WHERE "Competition" = 'scottish cup' AND "Date" = '29.02.2000' | wikisql |
CREATE TABLE table_26060884_2 (
burglary INTEGER,
property_crimes VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the maximum burglary statistics if the property crimes is 168630?
| SELECT MAX(burglary) FROM table_26060884_2 WHERE property_crimes = 168630 | sql_create_context |
CREATE TABLE Products (
product_id INTEGER,
product_type_code VARCHAR(10),
product_name VARCHAR(80),
product_price DECIMAL(19,4)
)
CREATE TABLE Addresses (
address_id INTEGER,
address_details VARCHAR(255)
)
CREATE TABLE Suppliers (
supplier_id INTEGER,
supplier_name VARCHAR(80),
su... | SELECT product_type_code, AVG(product_price) FROM Products GROUP BY product_type_code | nvbench |
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.
-- current drug ... | SELECT * FROM table_train_186 WHERE alcohol_abuse = 1 OR regular_alcohol_intake > 14 | criteria2sql |
CREATE TABLE journal_committee (
editor_id number,
journal_id number,
work_type text
)
CREATE TABLE journal (
journal_id number,
date text,
theme text,
sales number
)
CREATE TABLE editor (
editor_id number,
name text,
age number
)
-- Using valid SQLite, answer the following q... | SELECT name FROM editor WHERE NOT editor_id IN (SELECT editor_id FROM journal_committee) | spider |
CREATE TABLE musical (
Name VARCHAR,
Musical_ID VARCHAR
)
CREATE TABLE actor (
Musical_ID VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Show names of musicals which have at least three actors.
| SELECT T2.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID HAVING COUNT(*) >= 3 | 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 demographic (
subject_id text,
hadm_id t... | 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.drug_type = "MAIN" AND lab.label = "Glucose, Body Fluid" | mimicsql_data |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE p... | SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-13127')) AND intakeoutput.cellpath LIKE '%intake%... | eicu |
CREATE TABLE table_name_99 (
tournament VARCHAR,
surface VARCHAR,
score VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Tell me the tournament with a hard surface for 6 1, 6 2
| SELECT tournament FROM table_name_99 WHERE surface = "hard" AND score = "6–1, 6–2" | sql_create_context |
CREATE TABLE course_offering (
offering_id int,
course_id int,
semester int,
section_number int,
start_time time,
end_time time,
monday varchar,
tuesday varchar,
wednesday varchar,
thursday varchar,
friday varchar,
saturday varchar,
sunday varchar,
has_final_proje... | SELECT COUNT(*) = 0 FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.has_exams = 'N' AND program_course.category LIKE '%ULCS%' | advising |
CREATE TABLE table_22464685_1 (
author VARCHAR,
transliteration VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- who is the auther when the transliteration is lasha-giorgis droindeli matiane?
| SELECT author FROM table_22464685_1 WHERE transliteration = "lasha-giorgis droindeli matiane" | sql_create_context |
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 jyjgzbb.JCRGH, jyjgzbb.JCRXM 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 ... | css |
CREATE TABLE table_name_99 (
rank INTEGER,
team VARCHAR,
games VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Grupo Capitol Valladolid's highest rank with more than 34 games?
| SELECT MAX(rank) FROM table_name_99 WHERE team = "grupo capitol valladolid" AND games > 34 | sql_create_context |
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
HOSP_DOC_CD text,
HOSP_DOC_NM text,
MED_DIRE_CD text,
MED_DIRE_NM text,... | SELECT t_kc21.MED_SER_ORG_NO FROM t_kc21 WHERE t_kc21.PERSON_ID = '77219096' GROUP BY t_kc21.MED_SER_ORG_NO ORDER BY COUNT(*) DESC | css |
CREATE TABLE table_22050544_4 (
event VARCHAR,
event__number VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the event name with the number 8M?
| SELECT event FROM table_22050544_4 WHERE event__number = "8M" | sql_create_context |
CREATE TABLE table_78204 (
"Date(s) conducted" text,
"Polling organisation/client" text,
"Cons" text,
"Plaid Cymru" text,
"Lib Dem" text,
"Others" text,
"Lead" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the cons for lib dem of 8%... | SELECT "Cons" FROM table_78204 WHERE "Lib Dem" = '8%' AND "Lead" = '27%' | wikisql |
CREATE TABLE table_3101 (
"No." real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" text,
"U.S. viewers (million)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What episode number has 2j53... | SELECT "No." FROM table_3101 WHERE "Production code" = '2J5352' | wikisql |
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.discharge_location = "REHAB/DISTINCT PART HOSP" AND lab.label = "Alkaline Phosphatase" | mimicsql_data |
CREATE TABLE table_39437 (
"Rank" real,
"Name" text,
"Nationality" text,
"1st (m)" real,
"2nd (m)" real,
"Points" real,
"Overall NT points" text,
"Overall WC points (Rank)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the sum o... | SELECT SUM("2nd (m)") FROM table_39437 WHERE "Rank" > '4' AND "1st (m)" < '111.5' | wikisql |
CREATE TABLE table_name_76 (
school_club_team VARCHAR,
player VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What school does Wayne Cooper play for?
| SELECT school_club_team FROM table_name_76 WHERE player = "wayne cooper" | sql_create_context |
CREATE TABLE table_30160 (
"Proceed to Quarter-final" text,
"Match points" text,
"Aggregate score" text,
"Points margin" real,
"Eliminated from competition" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the aggregate score for Montauban?
| SELECT "Aggregate score" FROM table_30160 WHERE "Proceed to Quarter-final" = 'Montauban' | wikisql |
CREATE TABLE table_name_60 (
date VARCHAR,
label VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When did sony music direct a label?
| SELECT date FROM table_name_60 WHERE label = "sony music direct" | sql_create_context |
CREATE TABLE documents_with_expenses (
document_id number,
budget_type_code text,
document_details text
)
CREATE TABLE documents (
document_id number,
document_type_code text,
project_id number,
document_date time,
document_name text,
document_description text,
other_details tex... | SELECT statement_id, statement_details FROM statements | spider |
CREATE TABLE table_6454 (
"Driver" text,
"Points" real,
"Season" text,
"Races" real,
"Percentage of possible points" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which season with 16 races had less than 321 points and a larger percent than 65.78 p... | SELECT "Season" FROM table_6454 WHERE "Points" < '321' AND "Percentage of possible points" > '65.78' AND "Races" = '16' | 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 r AS Registrated, COUNT(1) AS Users, SUM(s) AS Writers, ROUND(SUM(s) * 100.0 / COUNT(1), 2) AS "writers_%" FROM (SELECT u.Id, (CASE WHEN SUM(CASE WHEN p.PostTypeId = 2 AND (p.Score >= @minVote) THEN 1 ELSE 0 END) >= @minPost THEN 1 ELSE 0 END) AS s, (TIME_TO_STR(u.CreationDate, '%Y') * 100 + TIME_TO_STR(u.Creati... | sede |
CREATE TABLE cinema (
cinema_id number,
name text,
openning_year number,
capacity number,
location text
)
CREATE TABLE schedule (
cinema_id number,
film_id number,
date text,
show_times_per_day number,
price number
)
CREATE TABLE film (
film_id number,
rank_in_series nu... | SELECT DISTINCT location FROM cinema | spider |
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,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),
START_DATE date... | SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 | nvbench |
CREATE TABLE table_46682 (
"Outcome" text,
"Date" text,
"Tournament" text,
"Surface" text,
"Partner" text,
"Opponents" text,
"Score" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Partner, when Outcome is Winner, and when Date is 12 ... | SELECT "Partner" FROM table_46682 WHERE "Outcome" = 'winner' AND "Date" = '12 october 2003' | wikisql |
CREATE TABLE table_70656 (
"Rank" text,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average Total, when the value for Silver is less than 1, when the value for Gold... | SELECT AVG("Total") FROM table_70656 WHERE "Silver" < '1' AND "Gold" = '0' AND "Nation" = 'switzerland' AND "Bronze" < '2' | wikisql |
CREATE TABLE table_46169 (
"Date" text,
"Opponent" text,
"Score" text,
"Result" text,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Score has an Opponent of @ seattle?
| SELECT "Score" FROM table_46169 WHERE "Opponent" = '@ seattle' | wikisql |
CREATE TABLE table_name_9 (
score VARCHAR,
home_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the score when Darlington is the home team?
| SELECT score FROM table_name_9 WHERE home_team = "darlington" | sql_create_context |
CREATE TABLE routes (
rid number,
dst_apid number,
dst_ap text,
src_apid number,
src_ap text,
alid number,
airline text,
codeshare text
)
CREATE TABLE airlines (
alid number,
name text,
iata text,
icao text,
callsign text,
country text,
active text
)
CREATE ... | SELECT COUNT(*), country FROM airports GROUP BY country ORDER BY COUNT(*) DESC | spider |
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_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE... | SELECT LAST_NAME, SALARY FROM employees WHERE FIRST_NAME LIKE '%m' ORDER BY SALARY DESC | nvbench |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.