instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_28045 ( "Series no." real, "No. in season" real, "Title" text, "Written by" text, "Directed by" text, "Original air date" text, "U.S. viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what season was writt...
SELECT MAX("No. in season") FROM table_28045 WHERE "Written by" = 'Jonathan Collier'
wikisql
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 outputevents ( ...
SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73652 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'urob...
mimic_iii
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE inputevents_cv ( ...
SELECT (SELECT COUNT(DISTINCT t1.subject_id) 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 d_icd_diagnoses.short_title = 'reflux eso...
mimic_iii
CREATE TABLE Lessons ( lesson_time INTEGER, customer_id VARCHAR ) CREATE TABLE Customers ( customer_id VARCHAR, first_name VARCHAR, last_name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How long is the total lesson time took by customer with ...
SELECT SUM(T1.lesson_time) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin"
sql_create_context
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY ...
SELECT LAST_NAME, MANAGER_ID FROM employees ORDER BY MANAGER_ID
nvbench
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId num...
SELECT AVG(0.5 * ViewCount / Score) AS Average FROM Posts WHERE PostTypeId = 1 AND Score > 0
sede
CREATE TABLE table_66376 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the attendance number when the result is l 41-37?
SELECT "Attendance" FROM table_66376 WHERE "Result" = 'l 41-37'
wikisql
CREATE TABLE table_train_54 ( "id" int, "organ_transplantation" bool, "severe_sepsis" bool, "systolic_blood_pressure_sbp" int, "hiv_infection" bool, "thrombocytopenia" float, "sepsis" bool, "hypotension" bool, "burn_injury" int, "septic_shock" bool, "age" float, "NOUSE" f...
SELECT * FROM table_train_54 WHERE hiv_infection = 1
criteria2sql
CREATE TABLE table_45186 ( "Date" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" text, "Competition" text, "Man of the Match" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result of the league/cup competition w...
SELECT "Result" FROM table_45186 WHERE "Competition" = 'league/cup' AND "Opponent" = 'swindon wildcats' AND "Man of the Match" = 'neil liddiard'
wikisql
CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numc...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'Koos Koole' AND writes.authorid = author.authorid
scholar
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) -- Using valid SQLite, answer the following questions for the...
SELECT Founder, SUM(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY Founder DESC
nvbench
CREATE TABLE table_62571 ( "Actor in original production" text, "Actor required" text, "GamePlan" text, "FlatSpin" text, "RolePlay" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the actor in the original production when Troy Stephens is the ...
SELECT "Actor in original production" FROM table_62571 WHERE "GamePlan" = 'troy stephens'
wikisql
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code tex...
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'immunoregulatory agents') AS t1 JOIN (SELECT patient.uniquepid, medicatio...
eicu
CREATE TABLE table_72976 ( "Aircraft" text, "1990" real, "destroyed" real, "damaged" real, "to Iran" real, "survived" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- If there were 14 in 1990 and 6 survived how many were destroyed?
SELECT "destroyed" FROM table_72976 WHERE "1990" = '14' AND "survived" = '6'
wikisql
CREATE TABLE table_11 ( "Pick" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's Dorain Anneck's pick number?
SELECT "Pick" FROM table_11 WHERE "Player" = 'Dorain Anneck'
wikisql
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 mzjzjlb.JZLSH FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE hz_info.person_info_XM = '鲁俊健' AND hz_info.YLJGDM = '5241360' AND mzjzjlb.JZKSMC LIKE '%肾内%'
css
CREATE TABLE table_train_33 ( "id" int, "active_infection" bool, "allergy_to_thiamine" bool, "receiving_vasopressor" bool, "liver_disease" bool, "allergy_to_vitamin_c" bool, "allergy_to_hydrocortisone" bool, "hypertension" bool, "age" float, "serum_aminotransferase_level_alt_ast"...
SELECT * FROM table_train_33 WHERE allergy_to_vitamin_c = 1 OR allergy_to_hydrocortisone = 1 OR allergy_to_thiamine = 1
criteria2sql
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 JZKSDM, JZKSMC FROM zyjzjlb WHERE JZLSH = '75933791795'
css
CREATE TABLE campuses ( id number, campus text, location text, county text, year number ) CREATE TABLE csu_fees ( campus number, year number, campusfee number ) CREATE TABLE discipline_enrollments ( campus number, discipline number, year number, undergraduate number, ...
SELECT degrees FROM campuses AS T1 JOIN degrees AS T2 ON t1.id = t2.campus WHERE t1.campus = "San Jose State University" AND t2.year = 2000
spider
CREATE TABLE table_name_53 ( score VARCHAR, tie_no VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the score when the tie is 8?
SELECT score FROM table_name_53 WHERE tie_no = "8"
sql_create_context
CREATE TABLE table_65300 ( "Human Gene (Protein)" text, "Mouse Ortholog" text, "Yeast Ortholog" text, "Subpathway" text, "GeneCards Entry" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the yeast ortholog that has a subpathway of GGR and Gen...
SELECT "Yeast Ortholog" FROM table_65300 WHERE "Subpathway" = 'ggr' AND "GeneCards Entry" = 'cetn2'
wikisql
CREATE TABLE table_name_50 ( ages VARCHAR, report VARCHAR, school VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the Ages of the Seashell Trust School with Ofsted Report?
SELECT ages FROM table_name_50 WHERE report = "ofsted" AND school = "seashell trust"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, ...
SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM...
css
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 USER_BY_TAG AS (SELECT ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS Rank, u.Id AS "user_link", u.age, COUNT(*) AS UpVotes FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON p.ParentId = pt.PostId INNER JOIN Votes AS v ON v.PostId = p.Id AND VoteTypeId = 2 INNER JOIN Users AS u ON...
sede
CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ) CREATE TABLE Participates_in ( stuid INTEGER, actid INTEGER ) CREATE TABLE Activity ( actid INTEGER, acti...
SELECT Sex, COUNT(*) FROM Faculty GROUP BY Sex
nvbench
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 MAX(t.TagName), COUNT(1) AS nbe_questions, AVG(Questions.Score) AS Q_score, AVG(Answers.Score) AS A_score FROM Posts AS Questions, Posts AS Answers, PostTags AS pt, Tags AS t WHERE pt.TagId = t.Id AND pt.PostId = Questions.Id AND pt.PostId = Questions.Id AND Questions.PostTypeId = 1 AND Answers.PostTypeId = 2 AN...
sede
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Posts ...
SELECT SUM(LENGTH(p.Body)) AS TotalLength, u.DisplayName AS UserName FROM Posts AS p INNER JOIN Users AS u ON p.OwnerUserId = u.Id GROUP BY u.DisplayName ORDER BY TotalLength DESC LIMIT 100
sede
CREATE TABLE table_1356555_2 ( median_household_income VARCHAR, county VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the median household income of sacramento?
SELECT median_household_income FROM table_1356555_2 WHERE county = "Sacramento"
sql_create_context
CREATE TABLE table_46719 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's...
SELECT "Record" FROM table_46719 WHERE "Game" = '56'
wikisql
CREATE TABLE table_2886617_5 ( college_junior_club_team VARCHAR, nhl_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How may college/junior/club team has a the nhl team listed as Colorado Avalanche?
SELECT COUNT(college_junior_club_team) FROM table_2886617_5 WHERE nhl_team = "Colorado Avalanche"
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 jyjgzbb.JYZBLSH FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz...
css
CREATE TABLE table_3492 ( "Institution" text, "Nickname" text, "Location (all in Minnesota)" text, "Founded" real, "Type" text, "Enrollment" real, "Joined" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What institution is located in St. Pet...
SELECT "Institution" FROM table_3492 WHERE "Location (all in Minnesota)" = 'St. Peter'
wikisql
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE vitalperiodic ( vitalp...
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '004-86136' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '004-86136' AND patient.hospitaldischargetime IS NULL)) AND tr...
eicu
CREATE TABLE table_2165 ( "Rank" real, "Dismissals" real, "Player" text, "Caught" real, "Stumped" real, "Matches" real, "Innings" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many dismissals in a game with 191 innings
SELECT COUNT("Dismissals") FROM table_2165 WHERE "Innings" = '191'
wikisql
CREATE TABLE table_18601 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the incumbent in Pennsylvania 27?
SELECT "Incumbent" FROM table_18601 WHERE "District" = 'Pennsylvania 27'
wikisql
CREATE TABLE region ( Region_ID int, Region_name text, Date text, Label text, Format text, Catalogue text ) CREATE TABLE party ( Party_ID int, Minister text, Took_office text, Left_office text, Region_ID int, Party_name text ) CREATE TABLE member ( Member_ID int, ...
SELECT Party_name, COUNT(*) FROM party_events AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_ID
nvbench
CREATE TABLE table_27319 ( "Region" text, "Enrolled men" real, "Enrolled women" real, "Enrolled total" real, "Men of voting age" real, "Women of voting age" real, "Voting age population" real, "E/VAP ratio Men" text, "E/VAP ratio Women" text, "E/VAP ratio Total" text ) -- Using...
SELECT "E/VAP ratio Total" FROM table_27319 WHERE "Men of voting age" = '123726'
wikisql
CREATE TABLE table_204_363 ( id number, "res." text, "record" text, "opponent" text, "method" text, "event" text, "date" text, "round" number, "time" text, "location" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. ...
SELECT "event" FROM table_204_363 WHERE "res." = 'win' AND "date" < (SELECT "date" FROM table_204_363 WHERE "event" = 'ufc 87') ORDER BY "date" DESC LIMIT 1
squall
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND demographic.diagnosis = "MESENTERIC ISCHEMIA"
mimicsql_data
CREATE TABLE table_name_93 ( draw INTEGER, language VARCHAR, place VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many draws have french as the language, with a place less than 1?
SELECT SUM(draw) FROM table_name_93 WHERE language = "french" AND place < 1
sql_create_context
CREATE TABLE table_dev_32 ( "id" int, "post_challenge_capillary_glucose" int, "gender" string, "blood_donation" bool, "untreated_hyperlipidemia" bool, "hemoglobin_a1c_hba1c" float, "hematocrit_hct" float, "fasting_triglycerides" int, "fasting_blood_glucose_fbg" float, "fasting_pl...
SELECT * FROM table_dev_32 WHERE (hematocrit_hct < 36 AND gender = 'male') OR (hematocrit_hct < 32 AND gender = 'female')
criteria2sql
CREATE TABLE table_name_35 ( year VARCHAR, assists VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year had 48 assists?
SELECT year FROM table_name_35 WHERE assists = "48"
sql_create_context
CREATE TABLE table_10975034_5 ( cfl_team VARCHAR, position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the cfl team that has a position of ol?
SELECT cfl_team FROM table_10975034_5 WHERE position = "OL"
sql_create_context
CREATE TABLE table_2562572_50 ( type VARCHAR, settlement VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What type of settlement is Jazak?
SELECT type FROM table_2562572_50 WHERE settlement = "Jazak"
sql_create_context
CREATE TABLE table_203_583 ( id number, "title" text, "release" number, "6th gen" text, "handheld" text, "note" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what game was published in europe as 1945 but had a different name elsewhere ?
SELECT "title" FROM table_203_583 WHERE "note" = 'released and published in europe by play it as 1945 i & ii: the arcade games'
squall
CREATE TABLE table_14490 ( "Rank" real, "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 sum of total with a Rank larger than 12, and a Gold larger than 4?
SELECT COUNT("Total") FROM table_14490 WHERE "Rank" > '12' AND "Gold" > '4'
wikisql
CREATE TABLE table_14308895_2 ( new_pageant VARCHAR, country_territory VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which is the new pageant from spain?
SELECT new_pageant FROM table_14308895_2 WHERE country_territory = "Spain"
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 demographic.insurance = "Self Pay" AND procedures.long_title = "Replacement of tube or enterostomy device of small intestine"
mimicsql_data
CREATE TABLE table_63183 ( "City of license" text, "Identifier" text, "Frequency" text, "Power" text, "Class" text, "RECNet" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the class when the identifier is cbf-fm-14?
SELECT "Class" FROM table_63183 WHERE "Identifier" = 'cbf-fm-14'
wikisql
CREATE TABLE table_203_287 ( id number, "rank" number, "area" text, "date" text, "presenter" text, "seven wonders covered" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the name of the last area listed on this chart ?
SELECT "area" FROM table_203_287 ORDER BY id DESC LIMIT 1
squall
CREATE TABLE table_name_37 ( player VARCHAR, place VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what player has place t10
SELECT player FROM table_name_37 WHERE place = "t10"
sql_create_context
CREATE TABLE table_name_27 ( d_44_√ VARCHAR, d_46_√ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the D 44 when D 46 is d 26?
SELECT d_44_√ FROM table_name_27 WHERE d_46_√ = "d 26"
sql_create_context
CREATE TABLE table_name_59 ( gold INTEGER, total VARCHAR, silver VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the fewest number of golds for teams with a total of 3 and fewer than 2 silvers?
SELECT MIN(gold) FROM table_name_59 WHERE total = 3 AND silver < 2
sql_create_context
CREATE TABLE Ref_Locations ( Location_Code CHAR(15), Location_Name VARCHAR(255), Location_Description VARCHAR(255) ) CREATE TABLE Employees ( Employee_ID INTEGER, Role_Code CHAR(15), Employee_Name VARCHAR(255), Gender_MFU CHAR(1), Date_of_Birth DATETIME, Other_Details VARCHAR(255) )...
SELECT Date_in_Locaton_To, COUNT(Date_in_Locaton_To) FROM Document_Locations GROUP BY Location_Code, Date_in_Locaton_To
nvbench
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body te...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%kanpur%' OR UPPER(Location) LIKE '%KANPUR' ORDER BY Reputation DESC LIMIT 5000
sede
CREATE TABLE table_55375 ( "Player" text, "Rec." real, "Yards" real, "Avg." real, "Long" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average rec that is greater than 10 and has 40 yards?
SELECT AVG("Rec.") FROM table_55375 WHERE "Yards" = '40' AND "Avg." > '10'
wikisql
CREATE TABLE table_62564 ( "Year" real, "Date" text, "Home Team" text, "Result" text, "Visiting Team" text, "Venue" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date(s) was the game(s) at Candlestick Park?
SELECT "Date" FROM table_62564 WHERE "Venue" = 'candlestick park'
wikisql
CREATE TABLE elimination ( elimination_id text, wrestler_id text, team text, eliminated_by text, elimination_move text, time text ) CREATE TABLE wrestler ( wrestler_id number, name text, reign text, days_held text, location text, event text ) -- Using valid SQLite, ans...
SELECT name FROM wrestler ORDER BY days_held DESC
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND lab.itemid = "51250"
mimicsql_data
CREATE TABLE table_204_90 ( id number, "rank" number, "name" text, "nationality" text, "time" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many medalists came from kenya ?
SELECT COUNT("name") FROM table_204_90 WHERE "nationality" = 'kenya'
squall
CREATE TABLE table_65540 ( "Date" text, "Round" text, "Attendance" real, "Opposition" text, "Stadium" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which stadium had the opposition of 79,122?
SELECT "Stadium" FROM table_65540 WHERE "Opposition" = '79,122'
wikisql
CREATE TABLE table_62683 ( "Main contestant" text, "Co-contestant (Yaar vs. Pyaar)" text, "Date performed" text, "Scores by each individual judge" text, "Total score/week" text, "Position" text, "Status" text ) -- Using valid SQLite, answer the following questions for the tables provided a...
SELECT "Scores by each individual judge" FROM table_62683 WHERE "Total score/week" = '41/60' AND "Co-contestant (Yaar vs. Pyaar)" = 'shalini chandran'
wikisql
CREATE TABLE table_24073 ( "Episode" text, "Broadcast date" text, "Run time" text, "Viewers (in millions)" text, "Archive" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On broadcast date is 25april1970, how many people tuned in?
SELECT "Viewers (in millions)" FROM table_24073 WHERE "Broadcast date" = '25April1970'
wikisql
CREATE TABLE table_76416 ( "Season" text, "Series" text, "Team" text, "Races" text, "Wins" text, "Poles" text, "F/Laps" text, "Podiums" text, "Points" text, "Position" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many races...
SELECT "Races" FROM table_76416 WHERE "Points" = '8'
wikisql
CREATE TABLE table_name_88 ( overall INTEGER, position VARCHAR, round VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest overall for a quarterback with fewer than 7 rounds?
SELECT MIN(overall) FROM table_name_88 WHERE position = "quarterback" AND round < 7
sql_create_context
CREATE TABLE Plays_games ( gameid VARCHAR, hours_played INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show all game ids and the number of hours played.
SELECT gameid, SUM(hours_played) FROM Plays_games GROUP BY gameid
sql_create_context
CREATE TABLE table_name_50 ( genre VARCHAR, origin_of_programming VARCHAR, network VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What genre is Star Plus from India?
SELECT genre FROM table_name_50 WHERE origin_of_programming = "india" AND network = "star plus"
sql_create_context
CREATE TABLE table_203_13 ( id number, "year" number, "champion" text, "score" text, "runner-up" text, "coach" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many total games did boston college win in the beanpot ?
SELECT COUNT(*) FROM table_203_13 WHERE "champion" = 'boston college'
squall
CREATE TABLE table_58651 ( "Date" text, "Time" text, "Score" text, "Set 1" text, "Set 2" text, "Set 3" text, "Total" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the time when the set 1 is 21 25?
SELECT "Time" FROM table_58651 WHERE "Set 1" = '21–25'
wikisql
CREATE TABLE table_17103566_1 ( result VARCHAR, team_1 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result when team 1 is ICL Pakistan?
SELECT result FROM table_17103566_1 WHERE team_1 = "ICL Pakistan"
sql_create_context
CREATE TABLE table_1886 ( "Seq." text, "Name" text, "Background" real, "Party Leadership" real, "Communication Ability" real, "Relations with Congress" real, "Court Appointments" real, "Handling of Economy" real, "Luck" real, "Ability to Compromise" real, "Willing to take Ris...
SELECT MAX("Ability to Compromise") FROM table_1886 WHERE "Seq." = '41'
wikisql
CREATE TABLE table_20592988_1 ( condition VARCHAR, platelet_count VARCHAR, prothrombin_time VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what conditions are both the platelet count and prothrombin time unaffected?
SELECT condition FROM table_20592988_1 WHERE platelet_count = "Unaffected" AND prothrombin_time = "Unaffected"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, ...
SELECT COUNT(*) FROM mzjzjlb JOIN hz_info_mzjzjlb JOIN hz_info ON hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.mzjzjlb_id = mzjzjlb.mzjzjlb_id AND hz_info_mzjzjlb.YLJGDM = hz_info.YLJGDM WHERE hz_info.YLJGDM = '58...
css
CREATE TABLE table_name_16 ( reign VARCHAR, days_held VARCHAR, wrestler VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the reign for super kendo who held it for 35 days?
SELECT reign FROM table_name_16 WHERE days_held = "35" AND wrestler = "super kendo"
sql_create_context
CREATE TABLE table_12394 ( "English" text, "Crimean Gothic" text, "Bible Gothic" text, "German" text, "Dutch" text, "Icelandic" text, "Swedish" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the Dutch word for Apel?
SELECT "Dutch" FROM table_12394 WHERE "Crimean Gothic" = 'apel'
wikisql
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, ...
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 = 'diphenhydramine 50 mg/1 ml 1 ml inj' AND STRFTIME('...
eicu
CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3) ) CREATE TABLE Player ( pID numeric(5,0), pName varchar(20), yCard varchar(3), HS numeric(5,0) ) CREATE TABLE College ( cName varchar(20), state varchar(2), enr numeric(5,0) ) ...
SELECT state, enr FROM College AS T1 JOIN Tryout AS T2 ON T1.cName = T2.cName WHERE T2.decision = 'yes' ORDER BY state
nvbench
CREATE TABLE driver ( Driver_ID int, Name text, Party text, Home_city text, Age int ) CREATE TABLE school_bus ( School_ID int, Driver_ID int, Years_Working int, If_full_time bool ) CREATE TABLE school ( School_ID int, Grade text, School text, Location text, Type...
SELECT Type, COUNT(*) FROM school_bus AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T2.Type ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_61323 ( "Episode" text, "18-49" text, "Viewers (m)" real, "Rating" text, "Share" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Viewers (m) has an Episode of 40 days?
SELECT "Viewers (m)" FROM table_61323 WHERE "Episode" = '40 days'
wikisql
CREATE TABLE table_26842217_12 ( result VARCHAR, broadcast VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result in the game broadcast on the Big East Network?
SELECT result FROM table_26842217_12 WHERE broadcast = "Big East Network"
sql_create_context
CREATE TABLE table_51191 ( "Player" text, "Position" text, "First-Team Appearances" text, "First-Team Goals" text, "Current Club" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many first-team goals does the team have whose player is Samir Carru...
SELECT "First-Team Goals" FROM table_51191 WHERE "Player" = 'samir carruthers'
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 admissions.marital_status FROM admissions WHERE admissions.subject_id = 85169 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1
mimic_iii
CREATE TABLE table_name_45 ( host_country___countries VARCHAR, bronze VARCHAR, host_city___cities VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the host country when bronze is [[|]] (1) and host city is Krynica?
SELECT host_country___countries FROM table_name_45 WHERE bronze = "[[|]] (1)" AND host_city___cities = "krynica"
sql_create_context
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 jyjgzbb.JYZBLSH FROM person_info JOIN hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND 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 jyb...
css
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dob_year < "2107" AND diagnoses.short_title = "Elev transaminase/ldh"
mimicsql_data
CREATE TABLE table_70494 ( "Venue" text, "City" text, "Tickets Sold / Available" text, "Gross Revenue (1986)" text, "Gross Revenue (2011)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many tickets were sold/available when the gross revenue (20...
SELECT "Tickets Sold / Available" FROM table_70494 WHERE "Gross Revenue (2011)" = '$366,916'
wikisql
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit te...
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id 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 d_icd_diagnoses.short_title =...
mimic_iii
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 WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND diagnoses.short_title = "Long-term use anticoagul"
mimicsql_data
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE admissions ( row_id num...
SELECT AVG(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'carrier nec') AND DATETIME(diagnoses_icd.charttime) <= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY ST...
mimic_iii
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId...
SELECT CONCAT('site://q/', q.Id, '|', q.Title) AS "linked_post" FROM PostLinks AS pl INNER JOIN Posts AS q ON q.Id = pl.PostId INNER JOIN PostTags AS pt ON pt.PostId = q.Id INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE RelatedPostId = '##postid:int?588004##' AND t.TagName = '##tagname:string?php##' AND LinkTypeId = 1
sede
CREATE TABLE table_63232 ( "School" text, "Location" text, "Mascot" text, "County" real, "Enrollment" text, "IHSAA Class" text, "Year Joined" real, "Previous Conference" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the IHSAA cl...
SELECT "IHSAA Class" FROM table_63232 WHERE "County" < '228'
wikisql
CREATE TABLE Roles ( Role_Code CHAR(15), Role_Name VARCHAR(255), Role_Description VARCHAR(255) ) CREATE TABLE Employees ( Employee_ID INTEGER, Role_Code CHAR(15), Employee_Name VARCHAR(255), Gender_MFU CHAR(1), Date_of_Birth DATETIME, Other_Details VARCHAR(255) ) CREATE TABLE Ref_L...
SELECT Location_Code, COUNT(Location_Code) FROM Document_Locations GROUP BY Location_Code ORDER BY Location_Code DESC
nvbench
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
SELECT MANAGER_ID, DEPARTMENT_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
nvbench
CREATE TABLE table_22118197_1 ( result VARCHAR, english_title VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result for the film with the English name of Morning Undersea?
SELECT result FROM table_22118197_1 WHERE english_title = "Morning Undersea"
sql_create_context
CREATE TABLE table_68213 ( "Year" real, "Manufacturer" text, "Start" real, "Finish" real, "Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the sum of year when start is less than 30
SELECT SUM("Year") FROM table_68213 WHERE "Start" < '30'
wikisql
CREATE TABLE table_42592 ( "Rank" real, "Name" text, "Years" text, "Games" real, "Goals" real, "Goals/Games" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest Rank for more than 220 goals in 1965 1978-78?
SELECT MAX("Rank") FROM table_42592 WHERE "Goals" > '220' AND "Years" = '1965–1978-78'
wikisql
CREATE TABLE table_name_59 ( location VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Location has a Record of 0-1?
SELECT location FROM table_name_59 WHERE record = "0-1"
sql_create_context
CREATE TABLE table_32678 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the size of the crowd when Essendon was...
SELECT "Crowd" FROM table_32678 WHERE "Away team" = 'essendon'
wikisql
CREATE TABLE table_name_6 ( wins VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of wins when there are 7 points?
SELECT wins FROM table_name_6 WHERE points = 7
sql_create_context
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREA...
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 = '021-100763')) AND lab.labname = 'fio2' AND STRFTIME('%y-%m', lab.labresulttime) >= ...
eicu