instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varcha... | SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) | nvbench |
CREATE TABLE table_65259 (
"Tie no" text,
"Home team" text,
"Score" text,
"Away team" text,
"Date" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the date when the tie no is 9?
| SELECT "Date" FROM table_65259 WHERE "Tie no" = '9' | wikisql |
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescript... | SELECT UserId AS "user_link", COUNT(*) AS "Total Badges", SUM(CASE WHEN Name IN ('Great Question', 'Great Answer', 'Populist') THEN 1 ELSE 0 END) AS "Gold", SUM(CASE WHEN Name IN ('Good Question', 'Enlightened', 'Guru', 'Good Answer', 'Necromancer') THEN 1 ELSE 0 END) AS "Silver", SUM(CASE WHEN Name IN ('Nice Question'... | sede |
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10),
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4)
)
CREATE TABLE COURSE (
CRS_CODE varchar(10),
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8)
... | SELECT STU_FNAME, COUNT(STU_FNAME) FROM STUDENT WHERE STU_GPA < (SELECT AVG(STU_GPA) FROM STUDENT) GROUP BY STU_FNAME | nvbench |
CREATE TABLE neighborhood (
id int,
business_id varchar,
neighborhood_name varchar
)
CREATE TABLE business (
bid int,
business_id varchar,
name varchar,
full_address varchar,
city varchar,
latitude varchar,
longitude varchar,
review_count bigint,
is_open tinyint,
rat... | SELECT business.city FROM business, category WHERE business.name = 'MGM Grand Buffet' AND business.state = 'Texas' AND category.business_id = business.business_id AND category.category_name = 'restaurant' | yelp |
CREATE TABLE body_builder (
total VARCHAR,
people_id VARCHAR
)
CREATE TABLE people (
people_id VARCHAR,
Birth_Date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the total scores of the body builders whose birthday contains the string 'Janu... | SELECT T1.total FROM body_builder AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id WHERE T2.Birth_Date LIKE "%January%" | sql_create_context |
CREATE TABLE body_builder (
body_builder_id number,
people_id number,
snatch number,
clean_jerk number,
total number
)
CREATE TABLE people (
people_id number,
name text,
height number,
weight number,
birth_date text,
birth_place text
)
-- Using valid SQLite, answer the fol... | SELECT COUNT(DISTINCT birth_place) FROM people | spider |
CREATE TABLE t_kc21 (
CLINIC_ID text,
CLINIC_TYPE text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD text,
INPT_AREA_BED text,
INSURED_IDENTITY number,
INSURED_STS text,
... | SELECT AVG(t_kc21.MED_AMOUT) FROM t_kc21 WHERE t_kc21.MED_ORG_DEPT_CD = '1791' AND t_kc21.IN_HOSP_DATE BETWEEN '2006-04-24' AND '2007-04-05' AND t_kc21.IN_DIAG_DIS_NM = '前列腺增生' AND t_kc21.CLINIC_TYPE = '住院' | css |
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE Po... | SELECT Id AS "post_link", OwnerUserId AS "user_link", CASE WHEN PostTypeId = 1 THEN 'Question' WHEN PostTypeId = 2 THEN 'Answer' END AS "q_or_a", DATE(LastActivityDate) AS "last_activity_date", LENGTH(Body) AS "length", CommentCount FROM Posts WHERE PostTypeId IN (1, 2) AND OwnerUserId = '##UserId##' ORDER BY CommentCo... | sede |
CREATE TABLE table_name_78 (
opponent VARCHAR,
score VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the opponent at the game with a score of 111-106?
| SELECT opponent FROM table_name_78 WHERE score = "111-106" | 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "WIDOWED" AND procedures.long_title = "Insertion of two vascular stents" | mimicsql_data |
CREATE TABLE table_204_400 (
id number,
"district" number,
"senator" text,
"party" text,
"caucus" text,
"first elected" number,
"counties represented" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- do the republicans have the same number of ... | SELECT (SELECT COUNT(*) FROM table_204_400 WHERE "party" = 'republican') = (SELECT COUNT(*) FROM table_204_400 WHERE "party" = 'democratic') | squall |
CREATE TABLE table_43424 (
"Episode number" real,
"Title" text,
"Original airing on Channel 4" text,
"Time of airing on Channel 4" text,
"Total viewers and Rank on C4" text,
"Total viewers" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is ... | SELECT AVG("Episode number") FROM table_43424 WHERE "Title" = 'sugar daddy' | wikisql |
CREATE TABLE Attribute_Definitions (
attribute_id INTEGER,
attribute_name VARCHAR(30),
attribute_data_type VARCHAR(10)
)
CREATE TABLE Catalogs (
catalog_id INTEGER,
catalog_name VARCHAR(50),
catalog_publisher VARCHAR(80),
date_of_publication DATETIME,
date_of_latest_revision DATETIME
)
... | SELECT date_of_latest_revision, COUNT(date_of_latest_revision) FROM Catalogs ORDER BY date_of_latest_revision | nvbench |
CREATE TABLE table_2320 (
"School" text,
"Location(s)" text,
"Control" text,
"Type" text,
"Enrollment" real,
"Founded" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which school would you come across if you were in Kirksville?
| SELECT "School" FROM table_2320 WHERE "Location(s)" = 'Kirksville' | wikisql |
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE program (
program_id int,
name varchar,
... | SELECT DISTINCT course_offering.end_time, course_offering.section_number, course_offering.start_time FROM course, course_offering, semester WHERE course_offering.start_time > '15:15' AND course.course_id = course_offering.course_id AND course.department = 'HISTORY' AND course.number = 586 AND semester.semester = 'WN' A... | advising |
CREATE TABLE VoteTypes (
Id number,
Name text
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number... | WITH IntelTags AS (SELECT Id, TagName, Count FROM Tags WHERE Tags.TagName LIKE 'intel-%' OR Tags.TagName = 'intel'), IntelPostIds AS (SELECT DISTINCT PostTags.PostId FROM PostTags INNER JOIN IntelTags ON IntelTags.Id = PostTags.TagId) SELECT MONTH(CreationDate) AS Month, COUNT(Id) AS Count FROM Posts INNER JOIN IntelPo... | sede |
CREATE TABLE table_51100 (
"Outcome" text,
"Date" real,
"Tournament" text,
"Surface" text,
"Partner" text,
"Opponents" text,
"Score" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which surface had a date after 1982 and partner of Guy Forget... | SELECT "Surface" FROM table_51100 WHERE "Date" > '1982' AND "Partner" = 'guy forget' | wikisql |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime... | 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 = '030-10407')) AND lab.labname = 'rdw' ORDER BY lab.labresult DESC, lab.labresulttime... | eicu |
CREATE TABLE table_7885 (
"Season" text,
"Skip" text,
"Third" text,
"Second" text,
"Lead" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Season, when Lead is 'Michael Goodfellow'?
| SELECT "Season" FROM table_7885 WHERE "Lead" = 'michael goodfellow' | wikisql |
CREATE TABLE table_33945 (
"Latitude" text,
"Longitude" text,
"City" text,
"State" text,
"Country" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- If the latitude is 71 18 n, what is the longitude?
| SELECT "Longitude" FROM table_33945 WHERE "Latitude" = '71°18′n' | wikisql |
CREATE TABLE table_24998088_1 (
series VARCHAR,
position VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In what series did he have the 7th position?
| SELECT series FROM table_24998088_1 WHERE position = "7th" | sql_create_context |
CREATE TABLE exhibition (
Exhibition_ID int,
Year int,
Theme text,
Artist_ID int,
Ticket_Price real
)
CREATE TABLE artist (
Artist_ID int,
Name text,
Country text,
Year_Join int,
Age int
)
CREATE TABLE exhibition_record (
Exhibition_ID int,
Date text,
Attendance int... | SELECT T1.Date, T1.Attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.Exhibition_ID = T2.Exhibition_ID WHERE T2.Year = 2004 ORDER BY Date | nvbench |
CREATE TABLE t_kc21 (
MED_CLINIC_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
COMP_ID text,
PERSON_ID text,
PERSON_NM text,
IDENTITY_CARD text,
SOC_SRT_CARD text,
PERSON_SEX number,
PERSON_AGE number,
IN_HOSP_DATE time,
OUT_HOSP_DATE time,
DIFF_PLACE_FLG numb... | SELECT MED_ORG_DEPT_NM, IN_DIAG_DIS_NM, AVG(PERSON_AGE) FROM t_kc21 WHERE MED_SER_ORG_NO = '5848199' GROUP BY MED_ORG_DEPT_NM, IN_DIAG_DIS_NM | css |
CREATE TABLE table_17311759_7 (
high_assists VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- who made high assists on february 4
| SELECT high_assists FROM table_17311759_7 WHERE date = "February 4" | sql_create_context |
CREATE TABLE table_78163 (
"Position" real,
"Song Title" text,
"Artist" text,
"Sales" real,
"Highest Position" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the most sales by a song with a position higher than 3?
| SELECT MAX("Sales") FROM table_78163 WHERE "Highest Position" > '3' | wikisql |
CREATE TABLE table_13936 (
"Pick" real,
"Player" text,
"Team" text,
"Position" text,
"School" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When Travis Lee was picked, what was the highest pick?
| SELECT MAX("Pick") FROM table_13936 WHERE "Player" = 'travis lee' | wikisql |
CREATE TABLE table_name_78 (
record VARCHAR,
game VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Record has a Game of 19?
| SELECT record FROM table_name_78 WHERE game = 19 | sql_create_context |
CREATE TABLE table_23860 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directedby" text,
"Writtenby" text,
"Originalairdate" text,
"Production code" text,
"U.S.viewers (million)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
... | SELECT MAX("No. in season") FROM table_23860 WHERE "U.S.viewers (million)" = '2.59' | wikisql |
CREATE TABLE table_203_152 (
id number,
"province" text,
"capital" text,
"area (km2)" number,
"population" number,
"density" number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the difference between the area of san cristobal and puerto pla... | SELECT ABS((SELECT "area (km2)" FROM table_203_152 WHERE "province" = 'san cristobal') - (SELECT "area (km2)" FROM table_203_152 WHERE "province" = 'puerto plata')) | squall |
CREATE TABLE table_name_78 (
player VARCHAR,
score VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What player scored 73-68-66=207?
| SELECT player FROM table_name_78 WHERE score = 73 - 68 - 66 = 207 | 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 diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "HOME" AND demographic.age < "68" | mimicsql_data |
CREATE TABLE table_name_16 (
incumbent VARCHAR,
district VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the incumbent in the 20th district?
| SELECT incumbent FROM table_name_16 WHERE district = "20th" | sql_create_context |
CREATE TABLE table_name_28 (
chest VARCHAR,
supplier VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Chest is Supplied by Gilbert?
| SELECT chest FROM table_name_28 WHERE supplier = "gilbert" | sql_create_context |
CREATE TABLE table_name_55 (
event VARCHAR,
location VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What event was in New Orleans, Louisiana, USA?
| SELECT event FROM table_name_55 WHERE location = "new orleans, louisiana, usa" | sql_create_context |
CREATE TABLE table_name_1 (
week INTEGER,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest week of the game on November 9, 1997?
| SELECT MAX(week) FROM table_name_1 WHERE date = "november 9, 1997" | sql_create_context |
CREATE TABLE table_32304 (
"Round" real,
"Overall" real,
"Player" text,
"Position" text,
"College" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which average overall has a Round of 1, and a Position of center?
| SELECT AVG("Overall") FROM table_32304 WHERE "Round" = '1' AND "Position" = 'center' | wikisql |
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate t... | SELECT * FROM Comments AS c WHERE c.PostId IN (SELECT Id FROM Posts WHERE YEAR(CreationDate) = 2015) | sede |
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,
intime time,
outtime time
)
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_... | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'entral infu... | mimic_iii |
CREATE TABLE table_name_81 (
position VARCHAR,
nationality VARCHAR,
player VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Position has a Nationality of canada, and a Player of pat janostin?
| SELECT position FROM table_name_81 WHERE nationality = "canada" AND player = "pat janostin" | sql_create_context |
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE Tags (
Id number,
TagName text,
Count ... | SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS MayRank, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS QuestionsInMay, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostId AN... | sede |
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 COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "HOME" AND demographic.diagnosis = "LEFT FEMUR FRACTURE" | mimicsql_data |
CREATE TABLE table_58706 (
"Year" real,
"Binibining Pilipinas-Universe" text,
"Binibining Pilipinas-International" text,
"Miss Maja Pilipinas" text,
"Binibining Pilipinas-Tourism" text,
"First runner-up" text,
"Second runner-up" text
)
-- Using valid SQLite, answer the following questions ... | SELECT "First runner-up" FROM table_58706 WHERE "Miss Maja Pilipinas" = 'nanette prodigalidad' | 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 diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | SELECT demographic.diagnosis, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Miguel Hodges" | mimicsql_data |
CREATE TABLE t_kc21_t_kc24 (
MED_CLINIC_ID text,
MED_SAFE_PAY_ID number
)
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,
... | SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_NM = '朱修德' AND NOT t_kc21.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT <= 2100.78) | css |
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
... | SELECT 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 = '006-171217')) AND medication.routeadmin = 'po' AND DATETIME(me... | eicu |
CREATE TABLE table_name_12 (
loss INTEGER,
gain VARCHAR,
avg_g VARCHAR,
long VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the loss when the average/gain is less than 16.7, gain is 104 and long is larger than 4?
| SELECT AVG(loss) FROM table_name_12 WHERE avg_g < 16.7 AND long > 4 AND gain = 104 | sql_create_context |
CREATE TABLE table_name_23 (
date VARCHAR,
away_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What day is hawthorn the away side?
| SELECT date FROM table_name_23 WHERE away_team = "hawthorn" | 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 MED_ORG_DEPT_CD, OUT_DIAG_DIS_NM, AVG(PERSON_AGE) FROM t_kc21 WHERE MED_SER_ORG_NO = '0297464' GROUP BY MED_ORG_DEPT_CD, OUT_DIAG_DIS_NM | css |
CREATE TABLE table_name_95 (
winner VARCHAR,
course VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who is the winner of the Florence to Genoa course?
| SELECT winner FROM table_name_95 WHERE course = "florence to genoa" | sql_create_context |
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CRE... | WITH Userdown AS (SELECT Posts.OwnerUserId AS UserId, COUNT(*) AS Downs FROM Posts, Votes WHERE Posts.PostTypeId = 2 AND Votes.PostId = Posts.Id AND Votes.VoteTypeId = 3 AND Posts.OwnerUserId > 0 GROUP BY Posts.OwnerUserId), UserA AS (SELECT Posts.OwnerUserId AS UserId, COUNT(*) AS Answers FROM Posts WHERE Posts.PostTy... | sede |
CREATE TABLE person_info (
CSD text,
CSRQ time,
GJDM text,
GJMC text,
JGDM text,
JGMC text,
MZDM text,
MZMC text,
RYBH text,
XBDM number,
XBMC text,
XLDM text,
XLMC text,
XM text,
ZYLBDM text,
ZYMC text
)
CREATE TABLE jybgb_jyjgzbb (
JYZBLSH number,
... | SELECT jyjgzbb.JCZBMC FROM jyjgzbb WHERE jyjgzbb.BGDH = '12429077632' INTERSECT SELECT jyjgzbb.JCZBMC FROM jyjgzbb WHERE jyjgzbb.BGDH = '99587287448' | css |
CREATE TABLE table_50466 (
"Municipality" text,
"Inhabitants" real,
"Mayor" text,
"Party" text,
"Election" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In what Election year were there less than 16,170 Inhabitants?
| SELECT COUNT("Election") FROM table_50466 WHERE "Inhabitants" < '16,170' | wikisql |
CREATE TABLE acceptance (
Author VARCHAR,
Submission_ID VARCHAR
)
CREATE TABLE submission (
Author VARCHAR,
Submission_ID VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- List the authors who do not have submission to any workshop.
| SELECT Author FROM submission WHERE NOT Submission_ID IN (SELECT Submission_ID FROM acceptance) | sql_create_context |
CREATE TABLE table_21977627_1 (
entrant VARCHAR,
driver VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many entrants was yves giraud-cabantous?
| SELECT COUNT(entrant) FROM table_21977627_1 WHERE driver = "Yves Giraud-Cabantous" | sql_create_context |
CREATE TABLE table_52204 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the grid for johnny herbert?
| SELECT "Grid" FROM table_52204 WHERE "Driver" = 'johnny herbert' | wikisql |
CREATE TABLE table_name_32 (
crowd INTEGER,
home_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the lowest Crowd Size for the Home Team of North Melbourne?
| SELECT MIN(crowd) FROM table_name_32 WHERE home_team = "north melbourne" | sql_create_context |
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
... | SELECT Title, Id, Score, ViewCount, CreationDate, PostTypeId FROM Posts WHERE CreationDate >= '2015-07-27 00:00:00.000' AND PostTypeId = 0 OR Score >= 25 | sede |
CREATE TABLE t_kc21 (
CLINIC_ID text,
CLINIC_TYPE text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD text,
INPT_AREA_BED text,
INSURED_IDENTITY number,
INSURED_STS text,
... | SELECT t_kc22.MED_ORG_DEPT_CD, t_kc22.MED_ORG_DEPT_NM FROM t_kc22 WHERE t_kc22.STA_DATE BETWEEN '2016-06-12' AND '2017-05-29' AND t_kc22.MED_INV_ITEM_TYPE = '手术费' GROUP BY t_kc22.MED_ORG_DEPT_CD ORDER BY COUNT(*) LIMIT 20 | css |
CREATE TABLE table_19020 (
"Year" real,
"Mens singles" text,
"Womens singles" text,
"Mens doubles" text,
"Womens doubles" text,
"Mixed doubles" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Beata syta is the minimum year for womens singles.
| SELECT MIN("Year") FROM table_19020 WHERE "Womens singles" = 'Beata Syta' | wikisql |
CREATE TABLE table_name_4 (
line_name VARCHAR,
terminus VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What line has Newmarket Junction terminus?
| SELECT line_name FROM table_name_4 WHERE terminus = "newmarket junction" | 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "8" AND diagnoses.long_title = "Fever presenting with conditions classified elsewhere" | 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 COUNT(mzjzjlb.ZZYSGH) 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 mzjzjlb.JZKSRQ BETWEEN '2012-10-17' AND '2017-12-25' | css |
CREATE TABLE table_name_21 (
date VARCHAR,
pole_position VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What date was Joakim Bonnier in the pole position?
| SELECT date FROM table_name_21 WHERE pole_position = "joakim bonnier" | sql_create_context |
CREATE TABLE table_19805130_3 (
share VARCHAR,
rank__night_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- If the night rank is 9, what is the total share number?
| SELECT COUNT(share) FROM table_19805130_3 WHERE rank__night_ = "9" | 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 student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total... | SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 496 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016 | advising |
CREATE TABLE table_19932 (
"Series Ep." text,
"Episode" real,
"Segment A" text,
"Segment B" text,
"Segment C" text,
"Segment D" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the titles of segment b when segment c is standby generators ... | SELECT "Segment B" FROM table_19932 WHERE "Segment C" = 'Standby Generators (Part 1)' | wikisql |
CREATE TABLE table_63200 (
"Year" real,
"Song" text,
"Artist" text,
"Genre" text,
"Band Tour Venue" text,
"Exportable?" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What song was made by the sex pistols?
| SELECT "Song" FROM table_63200 WHERE "Artist" = 'sex pistols' | wikisql |
CREATE TABLE table_56759 (
"Date" text,
"Home Team" text,
"Score" text,
"Visiting Team" text,
"Stadium" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which score has a Home Team of saskatoon accelerators?
| SELECT "Score" FROM table_56759 WHERE "Home Team" = 'saskatoon accelerators' | wikisql |
CREATE TABLE table_59907 (
"Season" text,
"Date Released" text,
"# Of Episodes" real,
"# Of Discs" real,
"Special Features" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Season, when # Of Episodes is '10', and when Date Released is '1 April... | SELECT "Season" FROM table_59907 WHERE "# Of Episodes" = '10' AND "Date Released" = '1 april 2010' | wikisql |
CREATE TABLE person_info (
RYBH text,
XBDM number,
XBMC text,
XM text,
CSRQ time,
CSD text,
MZDM text,
MZMC text,
GJDM text,
GJMC text,
JGDM text,
JGMC text,
XLDM text,
XLMC text,
ZYLBDM text,
ZYMC text
)
CREATE TABLE mzjzjlb (
YLJGDM text,
JZLSH ... | SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM mzjzjlb JOIN jybgb JOIN jyjgzbb ON mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE mzjzjlb.JZZDBM = 'H11.754' AND jyjgzbb.JCZBDM = '816429' | css |
CREATE TABLE flight_stop (
flight_id int,
stop_number int,
stop_days text,
stop_airport text,
arrival_time int,
arrival_airline text,
arrival_flight_number int,
departure_time int,
departure_airline text,
departure_flight_number int,
stop_time int
)
CREATE TABLE aircraft (
... | SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.c... | atis |
CREATE TABLE table_12348 (
"Player" text,
"Round" real,
"Pick" real,
"Position" text,
"NFL Club" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the position of the player picked at 243?
| SELECT "Position" FROM table_12348 WHERE "Pick" > '243' | wikisql |
CREATE TABLE table_name_87 (
losses INTEGER,
games VARCHAR,
season VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the greatest number of losses a team that played fewer than 25 games in 2010 had?
| SELECT MAX(losses) FROM table_name_87 WHERE games < 25 AND season = "2010" | sql_create_context |
CREATE TABLE reservations (
code number,
room text,
checkin text,
checkout text,
rate number,
lastname text,
firstname text,
adults number,
kids number
)
CREATE TABLE rooms (
roomid text,
roomname text,
beds number,
bedtype text,
maxoccupancy number,
basepric... | SELECT roomname FROM rooms ORDER BY maxoccupancy DESC LIMIT 1 | spider |
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 * 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 = '80143781' AND hz_info.YLJGDM = '9437300' AND NOT zyjzjlb.CYKSMC LIKE '%甲状腺%' | css |
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE flight_fare (
flight_id int,
fare_id int
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minu... | 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 = 'MEMPHIS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SEATTL... | atis |
CREATE TABLE table_21727 (
"Series #" real,
"Episode #" real,
"Title" text,
"Directed by" text,
"Written by" text,
"U.S. viewers (million)" text,
"Original airdate" text,
"Production Code" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- W... | SELECT COUNT("Original airdate") FROM table_21727 WHERE "Episode #" = '8' | wikisql |
CREATE TABLE table_name_42 (
entrant VARCHAR,
year VARCHAR,
chassis VARCHAR,
points VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the entrant of a chassis maserati 250f, also has 6 points and older than year 1957?
| SELECT entrant FROM table_name_42 WHERE chassis = "maserati 250f" AND points = "6" AND year < 1957 | sql_create_context |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
h... | SELECT (SELECT vitalperiodic.respiration FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-62948')) AND NOT vitalperiodic.respiration ... | eicu |
CREATE TABLE table_10586064_2 (
county VARCHAR,
total VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What country had the total 18,900 (r)?
| SELECT county FROM table_10586064_2 WHERE total = "18,900 (R)" | sql_create_context |
CREATE TABLE table_name_83 (
Id VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- With a 2011 of 0 what was the 2006 result?
| SELECT 2006 FROM table_name_83 WHERE 2011 = "0" | 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 demographic ... | SELECT MIN(demographic.days_stay) FROM demographic WHERE demographic.dob_year > "2200" | mimicsql_data |
CREATE TABLE table_27988559_1 (
original_air_date VARCHAR,
production_code VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many dates did the episode with a production code of 804 originally air on?
| SELECT COUNT(original_air_date) FROM table_27988559_1 WHERE production_code = 804 | sql_create_context |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE tr... | 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 = 4288)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit... | mimic_iii |
CREATE TABLE table_name_86 (
tuner VARCHAR,
governing_body VARCHAR,
team VARCHAR,
season VARCHAR,
driver VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who is the tuner after season 2004 with Gaurav Gill as the driver, Team MRF, and Mai governing... | SELECT tuner FROM table_name_86 WHERE season > 2004 AND driver = "gaurav gill" AND team = "team mrf" AND governing_body = "mai" | sql_create_context |
CREATE TABLE table_name_82 (
score VARCHAR,
year VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What score has 1998 as the year?
| SELECT score FROM table_name_82 WHERE year = 1998 | sql_create_context |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Acute on chronic combined systolic and diastolic heart failure" | mimicsql_data |
CREATE TABLE table_name_2 (
money_requested__£_ VARCHAR,
entrepreneur_s_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How much money did James Seddon request?
| SELECT money_requested__£_ FROM table_name_2 WHERE entrepreneur_s_ = "james seddon" | sql_create_context |
CREATE TABLE table_29302711_12 (
matches_won VARCHAR,
name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many matches did colin dibley win
| SELECT matches_won FROM table_29302711_12 WHERE name = "Colin Dibley" | sql_create_context |
CREATE TABLE table_22878 (
"Outcome" text,
"Year" real,
"Championship" text,
"Surface" text,
"Partner" text,
"Opponents in the final" text,
"Score in the final" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- when were helena sukov todd woodb... | SELECT "Year" FROM table_22878 WHERE "Opponents in the final" = 'Helena Suková Todd Woodbridge' | wikisql |
CREATE TABLE table_54009 (
"Year" text,
"TCKL" real,
"SACK" real,
"P/KO RET" real,
"YARDS" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest YARDS with a TCKL more than 51 and less than 2 SACK?
| SELECT MAX("YARDS") FROM table_54009 WHERE "TCKL" > '51' AND "SACK" < '2' | wikisql |
CREATE TABLE shop (
Shop_Name VARCHAR,
Open_Year VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- List the name of the shop with the latest open year.
| SELECT Shop_Name FROM shop ORDER BY Open_Year DESC LIMIT 1 | sql_create_context |
CREATE TABLE table_name_88 (
poll_source VARCHAR,
lead_margin VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which organization administered the poll that showed a lead margin of 5.5?
| SELECT poll_source FROM table_name_88 WHERE lead_margin = 5.5 | 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_CLINIC_ID text,
MED_DIRE_CD tex... | SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM, t_kc22.QTY, t_kc22.UNIVALENT, t_kc22.AMOUNT FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '孔曼青' AND t_kc22.t_kc21_IN_HOSP_DATE BETWEEN '2001-08-29' AND '2015-03-17' | css |
CREATE TABLE table_name_76 (
opponent VARCHAR,
save VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the opponent in the game with save ||33,723||93 64?
| SELECT opponent FROM table_name_76 WHERE save = "||33,723||93–64" | sql_create_context |
CREATE TABLE table_27017 (
"Outcome" text,
"Year" real,
"Championship" text,
"Surface" text,
"Partner" text,
"Opponents" text,
"Score" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the score for winner and julie halard-decugis ai sugiy... | SELECT "Score" FROM table_27017 WHERE "Outcome" = 'Winner' AND "Opponents" = 'Julie Halard-Decugis Ai Sugiyama' | wikisql |
CREATE TABLE table_name_40 (
home_team VARCHAR,
tie_no VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What home team has 8 ties?
| SELECT home_team FROM table_name_40 WHERE tie_no = "8" | sql_create_context |
CREATE TABLE table_21299 (
"Game" real,
"Date" text,
"Opponent" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location/Attendance" text,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Na... | SELECT COUNT("High assists") FROM table_21299 WHERE "Date" = 'July 1' | wikisql |
CREATE TABLE table_38419 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the score on April 23?
| SELECT "Score" FROM table_38419 WHERE "Date" = 'april 23' | wikisql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.