instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_name_27 ( ravg VARCHAR, ratt VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the RAvg of the year with Ratt of 9?
SELECT ravg FROM table_name_27 WHERE ratt = "9"
sql_create_context
CREATE TABLE table_name_3 ( tries_for VARCHAR, points VARCHAR, tries_against VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many tries for are associated with 5 points and 2 tries against?
SELECT tries_for FROM table_name_3 WHERE points = "5" AND tries_against = "2"
sql_create_context
CREATE TABLE table_18268826_1 ( no_in_season INTEGER, us_viewers__million_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the season number of the episode viewed by 3.19 million people in the US?
SELECT MAX(no_in_season) FROM table_18268826_1 WHERE us_viewers__million_ = "3.19"
sql_create_context
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 * FROM PostHistory AS ph WHERE ph.PostId = (SELECT t.WikiPostId FROM Tags AS t WHERE t.TagName = '##TagName:string##') ORDER BY CreationDate
sede
CREATE TABLE stock ( Shop_ID int, Device_ID int, Quantity int ) CREATE TABLE device ( Device_ID int, Device text, Carrier text, Package_Version text, Applications text, Software_Platform text ) CREATE TABLE shop ( Shop_ID int, Shop_Name text, Location text, Open_Dat...
SELECT Location, COUNT(Location) FROM shop GROUP BY Location
nvbench
CREATE TABLE bdmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZ...
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jyb...
css
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, Acc...
SELECT CONCAT(YEAR(P.CreationDate), '-', MONTH(P.CreationDate)) AS YearMonth, 'MongoDB' AS TagName, COUNT(*) AS PostCount FROM Posts AS P INNER JOIN PostTags AS PT ON (P.Id = PT.PostId) INNER JOIN Tags AS T ON (PT.TagId = T.Id) WHERE T.TagName LIKE 'mongodb%' GROUP BY YEAR(P.CreationDate), MONTH(P.CreationDate) ORDER B...
sede
CREATE TABLE table_245801_1 ( launch_date VARCHAR, crew VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the launch date for vladimir lyakhov , aleksandr pavlovich aleksandrov
SELECT launch_date FROM table_245801_1 WHERE crew = "Vladimir Lyakhov , Aleksandr Pavlovich Aleksandrov"
sql_create_context
CREATE TABLE table_38927 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Save" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When has an Opponent of at Seattle mariners?
SELECT "Date" FROM table_38927 WHERE "Opponent" = 'at seattle mariners'
wikisql
CREATE TABLE station ( id number, network_name text, services text, local_authority text ) CREATE TABLE train ( id number, train_number number, name text, origin text, destination text, time text, interval text ) CREATE TABLE weekly_weather ( station_id number, day_...
SELECT COUNT(DISTINCT services) FROM station
spider
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT t_kc24.t_kc21_IN_DIAG_DIS_CD, t_kc24.t_kc21_IN_DIAG_DIS_NM FROM t_kc24 WHERE t_kc24.t_kc21_PERSON_NM = '鲁建修' AND t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 4854.45)
css
CREATE TABLE table_1449176_1 ( density__inhabitants_km_2__ VARCHAR, common_of VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- The common of Chieri has what population density?
SELECT density__inhabitants_km_2__ FROM table_1449176_1 WHERE common_of = "Chieri"
sql_create_context
CREATE TABLE table_12824 ( "Rank" real, "Family" text, "Abbre\u00adviation" text, "Constellation" text, "Area (sq.deg.)" real, "Area (msr)" real, "Per\u00adcent\u00adage" text, "Right ascension (hm)" real, "Decli\u00adnation (dm)" text, "Quad" text ) -- Using valid SQLite, answ...
SELECT MAX("Area (msr)") FROM table_12824 WHERE "Area (sq.deg.)" < '291.045' AND "Family" = 'per' AND "Rank" > '78'
wikisql
CREATE TABLE table_25318033_1 ( team VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What team has 137 points?
SELECT team FROM table_25318033_1 WHERE points = "137"
sql_create_context
CREATE TABLE table_name_99 ( attendance VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Attendance on august 15?
SELECT attendance FROM table_name_99 WHERE date = "august 15"
sql_create_context
CREATE TABLE table_44155 ( "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 i...
SELECT COUNT("Game") FROM table_44155 WHERE "Team" = '@ new york'
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 lab ( subject_id text, hadm_id text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "BOWEL OBSTRUCTION" AND demographic.age < "56"
mimicsql_data
CREATE TABLE table_name_43 ( time VARCHAR, notes VARCHAR, country VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the time with FB notes for Canada?
SELECT time FROM table_name_43 WHERE notes = "fb" AND country = "canada"
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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "BLACK/HAITIAN" AND prescriptions.route = "ED"
mimicsql_data
CREATE TABLE candidate ( candidate_id number, people_id number, poll_source text, date text, support_rate number, consider_rate number, oppose_rate number, unsure_rate number ) CREATE TABLE people ( people_id number, sex text, name text, date_of_birth text, height nu...
SELECT name FROM people WHERE height > 200 OR height < 190
spider
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 text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.insurance = "Government"
mimicsql_data
CREATE TABLE table_59699 ( "Nat." text, "Name" text, "Moving to" text, "Type" text, "Transfer window" text, "Transfer fee" text, "Source" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT NAME HAS A FREE TRANSFER FREE AND RETIRED?
SELECT "Name" FROM table_59699 WHERE "Transfer fee" = 'free' AND "Moving to" = 'retired'
wikisql
CREATE TABLE table_79682 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score on 1/10/1974?
SELECT "Score" FROM table_79682 WHERE "Date" = '1/10/1974'
wikisql
CREATE TABLE products ( product_id number, product_details text ) CREATE TABLE customer_addresses ( customer_id number, address_id number, date_address_from time, address_type text, date_address_to time ) CREATE TABLE customers ( customer_id number, payment_method text, custome...
SELECT SUM(t3.order_quantity) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = "Rodrick Heaney"
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 t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.IN_DIAG_DIS_CD = 'C17.069'
css
CREATE TABLE table_name_9 ( record VARCHAR, visitor VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the record when Vancouver was the visitor?
SELECT record FROM table_name_9 WHERE visitor = "vancouver"
sql_create_context
CREATE TABLE table_name_28 ( jun VARCHAR, jul VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the june when it has july of 84 f / 28.9 c
SELECT jun FROM table_name_28 WHERE jul = "84 °f / 28.9 °c"
sql_create_context
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, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0...
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(SALARY)
nvbench
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "DIVORCED" AND lab.label = "tacroFK"
mimicsql_data
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT AVG(demographic.age) FROM demographic WHERE demographic.diagnosis = "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT " AND demographic.days_stay = "10"
mimicsql_data
CREATE TABLE table_32875 ( "Name" text, "Circuit" text, "Date" text, "Winning driver" text, "Winning constructor" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which winning driver of the Roussillon Grand Prix had an Alfa Romeo?
SELECT "Winning driver" FROM table_32875 WHERE "Winning constructor" = 'alfa romeo' AND "Name" = 'roussillon grand prix'
wikisql
CREATE TABLE jybgb ( YLJGDM text, YLJGDM_MZJZJLB text, YLJGDM_ZYJZJLB text, BGDH text, BGRQ time, JYLX number, JZLSH text, JZLSH_MZJZJLB text, JZLSH_ZYJZJLB text, JZLX number, KSBM text, KSMC text, SQRGH text, SQRXM text, BGRGH text, BGRXM text, SHRGH ...
SELECT BGJGDM, BGJGMC FROM jybgb WHERE BGDH = '81389511365'
css
CREATE TABLE table_50345 ( "Callsign" text, "Area served" text, "Band" text, "Freq currently" text, "Purpose" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Purpose of the Callsign with a Freq currently of 4gld?
SELECT "Purpose" FROM table_50345 WHERE "Freq currently" = '4gld'
wikisql
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate ti...
SELECT * FROM Users LIMIT 10
sede
CREATE TABLE table_6141 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the 1st leg of the team with a 2-1 agg.?
SELECT "1st leg" FROM table_6141 WHERE "Agg." = '2-1'
wikisql
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, ...
SELECT Users.Id AS "user_link", MAX(Age) AS Age, MAX(Location) AS Location, MAX(WebsiteUrl) AS Website, MAX(Reputation) AS Rep, COUNT(Answers.Id) AS Answers, SUM(Answers.Score) AS Score, CAST(AVG(CAST(Answers.Score AS FLOAT)) AS FLOAT(6, 1)) AS "avg" FROM Tags JOIN PostTags ON PostTags.TagId = Tags.Id JOIN Posts ON Pos...
sede
CREATE TABLE participants ( participant_id number, participant_type_code text, participant_details text ) CREATE TABLE services ( service_id number, service_type_code text ) CREATE TABLE events ( event_id number, service_id number, event_details text ) CREATE TABLE participants_in_eve...
SELECT participant_id, participant_type_code, participant_details FROM participants
spider
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime t...
SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'lorazepam' AND patient.uniquepid = '015-52724' AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-54 mo...
eicu
CREATE TABLE table_1342370_10 ( district VARCHAR, first_elected VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what district was the representative first elected in 1916?
SELECT district FROM table_1342370_10 WHERE first_elected = 1916
sql_create_context
CREATE TABLE table_61823 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Results" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the party for the representative who was first elected before 2002 and the results wer...
SELECT "Party" FROM table_61823 WHERE "Results" = 're-elected' AND "First elected" < '2002'
wikisql
CREATE TABLE table_14433719_1 ( time___et__ VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What time in eastern standard time was game held at denver broncos?
SELECT time___et__ FROM table_14433719_1 WHERE opponent = "at Denver Broncos"
sql_create_context
CREATE TABLE table_10753917_1 ( margin_of_defeat VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which margin of defeats had points of 30?
SELECT margin_of_defeat FROM table_10753917_1 WHERE points = "30"
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...
SELECT q.Id AS "post_link" FROM Posts AS a INNER JOIN Posts AS q ON q.Id = a.ParentId WHERE a.OwnerUserId = '##UserID##' AND (SELECT MAX(p.Score) FROM Posts AS p WHERE p.ParentId = q.Id AND p.Id != a.Id) < a.Score ORDER BY q.ViewCount DESC
sede
CREATE TABLE table_name_40 ( dob VARCHAR, surname VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which DOB has a Surname of cresswell?
SELECT dob FROM table_name_40 WHERE surname = "cresswell"
sql_create_context
CREATE TABLE table_29636 ( "Season" text, "Episodes" real, "Timeslot ( EST )" text, "Season premiere" text, "Season finale" text, "TV season" text, "Rank" text, "Viewers (in millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How m...
SELECT COUNT("Season premiere") FROM table_29636 WHERE "Viewers (in millions)" = '15.27'
wikisql
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellv...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT microlab.patientunitstayid FROM microlab WHERE microlab.culturesite = 'sputum, tracheal specimen' AND STRFTIME('%y', microlab.culturetakentime) >= '2105')
eicu
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 jybgb WHERE jybgb.JZLSH = '91555102556'
css
CREATE TABLE table_name_36 ( county VARCHAR, mascot VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which County has a Mascot of pacers?
SELECT county FROM table_name_36 WHERE mascot = "pacers"
sql_create_context
CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE tra...
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20693) AND DATETIME(procedures_icd.charttime) >= DATETIME(CURRENT_TIME(), '-3 year') ORDER BY procedures_icd.charttime LIMIT 1
mimic_iii
CREATE TABLE table_78481 ( "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. -- During st kilda's home game, what was the number...
SELECT "Crowd" FROM table_78481 WHERE "Home team" = 'st kilda'
wikisql
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAno...
SELECT u.Id AS "user_link", CONCAT('https://stackoverflow.com/users/', u.Id) AS "profile_link", u.DisplayName, u.Location, u.WebsiteUrl, u.AboutMe, u.Views, u.UpVotes, u.DownVotes FROM Users AS u JOIN (SELECT DISTINCT UserId FROM Badges WHERE LOWER(Name) IN ('android-espresso') AND Class IN (1, 2, 3) AND TagBased = 1) ...
sede
CREATE TABLE table_50302 ( "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 lowest Gold, when Silver is 0, and when Bronze is 2?
SELECT MIN("Gold") FROM table_50302 WHERE "Silver" = '0' AND "Bronze" = '2'
wikisql
CREATE TABLE table_14045 ( "Polling firm" text, "Dates" text, "Prog. Cons." text, "New Democratic" text, "Liberal" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What percentage of people polled aligned with the Liberal party according to the August...
SELECT "Liberal" FROM table_14045 WHERE "New Democratic" = '36%' AND "Dates" = 'august 2008'
wikisql
CREATE TABLE table_142573_1 ( clock_rate__mhz_ VARCHAR, bandwidth__mb_s_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the number of clock rate mhz when bandwidth mb/s is 2400
SELECT COUNT(clock_rate__mhz_) FROM table_142573_1 WHERE bandwidth__mb_s_ = 2400
sql_create_context
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TA...
SELECT ph.PostId AS "post_link", ph.CreationDate AS "protected_date", CASE ph.UserId WHEN NULL THEN ph.UserDisplayName ELSE ph.UserId END AS "user_link" FROM PostHistory AS ph WHERE ph.PostHistoryTypeId = 19 ORDER BY ph.PostId, ph.CreationDate
sede
CREATE TABLE table_64012 ( "Serial No." real, "District" text, "Headquartered City" text, "City Population (2009)" real, "City Area(km 2 )" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What district was the city with an area smaller than 12 square...
SELECT "District" FROM table_64012 WHERE "City Area(km 2 )" < '12' AND "Serial No." = '35'
wikisql
CREATE TABLE table_70335 ( "Race" real, "Circuit" text, "Location / State" text, "Date" text, "Winner" text, "Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many races were in the Mallala Motor Sport Park circuit?
SELECT COUNT("Race") FROM table_70335 WHERE "Circuit" = 'mallala motor sport park'
wikisql
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 jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW 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 ...
css
CREATE TABLE company ( Company_ID real, Name text, Headquarters text, Industry text, Sales_in_Billion real, Profits_in_Billion real, Assets_in_Billion real, Market_Value_in_Billion real ) CREATE TABLE people ( People_ID int, Age int, Name text, Nationality text, Grad...
SELECT Industry, COUNT(Industry) FROM company GROUP BY Industry
nvbench
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TA...
SELECT q.Id, q.CreationDate, u.Reputation FROM Posts AS q INNER JOIN Users AS u ON u.Id = q.OwnerUserId WHERE q.PostTypeId = 2 ORDER BY q.CreationDate DESC LIMIT 100
sede
CREATE TABLE captain ( Captain_ID int, Name text, Ship_ID int, age text, Class text, Rank text ) CREATE TABLE Ship ( Ship_ID int, Name text, Type text, Built_Year real, Class text, Flag text ) -- Using valid SQLite, answer the following questions for the tables provide...
SELECT Rank, COUNT(*) FROM captain GROUP BY Rank ORDER BY Rank DESC
nvbench
CREATE TABLE table_47955 ( "Date" text, "Region" text, "Label" text, "Catalogue" text, "Format" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Date, when Label is Jugoton?
SELECT "Date" FROM table_47955 WHERE "Label" = 'jugoton'
wikisql
CREATE TABLE table_61081 ( "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 Tie no when Swansea City is the Away team with a Score of 2 2?
SELECT "Tie no" FROM table_61081 WHERE "Score" = '2–2' AND "Away team" = 'swansea city'
wikisql
CREATE TABLE table_203_515 ( id number, "rank" number, "city" text, "passengers" number, "ranking" number, "airline" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many more passengers flew to los angeles than to saskatoon from manzanillo ai...
SELECT (SELECT "passengers" FROM table_203_515 WHERE "city" = 'los angeles') - (SELECT "passengers" FROM table_203_515 WHERE "city" = 'saskatoon')
squall
CREATE TABLE table_25129482_1 ( capacity INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the largest capacity for a stadium?
SELECT MAX(capacity) FROM table_25129482_1
sql_create_context
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 * FROM t_kc21 WHERE MED_SER_ORG_NO = '7538137' AND IN_HOSP_DATE BETWEEN '2017-06-01' AND '2020-11-13') EXCEPT (SELECT * FROM t_kc21 WHERE MED_SER_ORG_NO = '7538137' AND IN_HOSP_DATE BETWEEN '2017-06-01' AND '2020-11-13' AND MED_ORG_DEPT_NM = '介入医学科')
css
CREATE TABLE table_4545 ( "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. -- Where did Geelong play as the away team?
SELECT "Venue" FROM table_4545 WHERE "Away team" = 'geelong'
wikisql
CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE flight_leg ( flight_id int, ...
SELECT DISTINCT flight.flight_id FROM airport AS AIRPORT_0, airport AS AIRPORT_1, flight WHERE (flight.to_airport = AIRPORT_0.airport_code AND AIRPORT_0.airport_code = 'MKE') OR (flight.from_airport = AIRPORT_1.airport_code AND AIRPORT_1.airport_code = 'MKE')
atis
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, ...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.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 = admissions...
mimic_iii
CREATE TABLE table_74160 ( "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. -- Where ...
SELECT "Location Attendance" FROM table_74160 WHERE "Date" = 'April 3'
wikisql
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 ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "50802" AND lab.flag = "delta"
mimicsql_data
CREATE TABLE table_4653 ( "Race Name" text, "Circuit" text, "City/Location" text, "Date" text, "Pole position" text, "Winning driver" text, "Winning team" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For the race Champio...
SELECT "Report" FROM table_4653 WHERE "Race Name" = 'champion spark plug 300'
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 t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-28507' AND patient.hospitaldi...
eicu
CREATE TABLE table_21330 ( "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. -- If...
SELECT "High points" FROM table_21330 WHERE "Score" = '62-70'
wikisql
CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_cred...
SELECT DISTINCT course_offering.friday 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.department = 'SM' AND course.number = 470 AND semester.semester = 'WN' AND semester.year = 2016
advising
CREATE TABLE table_38441 ( "Year" real, "Starts" real, "Wins" real, "Top 5" real, "Top 10" real, "Poles" real, "Avg. Start" real, "Avg. Finish" real, "Winnings" text, "Position" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How ...
SELECT COUNT("Top 10") FROM table_38441 WHERE "Wins" > '0' AND "Poles" > '0'
wikisql
CREATE TABLE table_8614 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result of the game after week 6 against the cleveland browns?
SELECT "Result" FROM table_8614 WHERE "Week" < '6' AND "Opponent" = 'cleveland browns'
wikisql
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 COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-30149')) AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME(...
eicu
CREATE TABLE table_name_87 ( swimsuit INTEGER, interview VARCHAR, average VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which smallest swimsuit number's interview was less than 8.574 when the average number was bigger than 8.532?
SELECT MIN(swimsuit) FROM table_name_87 WHERE interview < 8.574 AND average > 8.532
sql_create_context
CREATE TABLE table_name_4 ( tournament VARCHAR, wins VARCHAR, top_5 VARCHAR, top_25 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the tournament for top-5 more thn 1 and top-25 of 13 with wins of 3
SELECT tournament FROM table_name_4 WHERE top_5 > 1 AND top_25 = 13 AND wins = 3
sql_create_context
CREATE TABLE table_name_89 ( nationality VARCHAR, position VARCHAR, years_for_grizzlies VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the nationality of a point guard position in 1999-2001?
SELECT nationality FROM table_name_89 WHERE position = "point guard" AND years_for_grizzlies = "1999-2001"
sql_create_context
CREATE TABLE table_20037 ( "Position" real, "Team" text, "Points" real, "Played" real, "Won" real, "Drawn" real, "Lost" real, "For" real, "Against" real, "Difference" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the hig...
SELECT MAX("Won") FROM table_20037 WHERE "Difference" = '1'
wikisql
CREATE TABLE table_55433 ( "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 laps when the driver is tony rolt and the grid is less than 10?
SELECT SUM("Laps") FROM table_55433 WHERE "Driver" = 'tony rolt' AND "Grid" < '10'
wikisql
CREATE TABLE table_53386 ( "Constructor" text, "Chassis" text, "Engine" text, "Tyre" text, "Driver" text, "Rounds" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who drove the car with the n175 chassis in round 13?
SELECT "Driver" FROM table_53386 WHERE "Chassis" = 'n175' AND "Rounds" = '13'
wikisql
CREATE TABLE purchase ( member_id number, branch_id text, year text, total_pounds number ) CREATE TABLE membership_register_branch ( member_id number, branch_id text, register_year text ) CREATE TABLE branch ( branch_id number, name text, open_year text, address_road text, ...
SELECT SUM(total_pounds) FROM purchase AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T2.city = 'London' AND T1.year = 2018
spider
CREATE TABLE table_name_69 ( model_number VARCHAR, part_number_s_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What model number has part number cl8064701510101?
SELECT model_number FROM table_name_69 WHERE part_number_s_ = "cl8064701510101"
sql_create_context
CREATE TABLE repair ( repair_ID int, name text, Launch_Date text, Notes text ) CREATE TABLE technician ( technician_id real, Name text, Team text, Starting_Year real, Age int ) CREATE TABLE machine ( Machine_ID int, Making_Year int, Class text, Team text, Machin...
SELECT Name, COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_id = T2.technician_id GROUP BY T2.Name ORDER BY COUNT(*)
nvbench
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 * FROM person_info JOIN hz_info JOIN zyjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE person_info.XM = '水天心' AND hz_info.YLJGDM = '5751240' AND zyjzjlb.CYKSMC LIKE '%计生%'
css
CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) 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, ...
SELECT t_kc21.MED_ORG_DEPT_CD, t_kc21.MED_ORG_DEPT_NM, AVG(t_kc21.IN_HOSP_DAYS) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '2471866' GROUP BY t_kc21.MED_ORG_DEPT_CD ORDER BY AVG(t_kc21.IN_HOSP_DAYS)
css
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TAB...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT microlab.patientunitstayid FROM microlab WHERE microlab.culturesite = 'sputum, tracheal specimen' AND STRFTIME('%y', microlab.culturetakentime) >= '2103')
eicu
CREATE TABLE table_name_16 ( team VARCHAR, position VARCHAR, pick VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Team, when Position is 'LHP', and when Pick is '23'?
SELECT team FROM table_name_16 WHERE position = "lhp" AND pick = 23
sql_create_context
CREATE TABLE table_name_20 ( total_matches VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many Total matches happened in 2003?
SELECT total_matches FROM table_name_20 WHERE year = "2003"
sql_create_context
CREATE TABLE table_30153 ( "State Rank" real, "National Rank" real, "Institution" text, "Location" text, "Public or Private" text, "Endowment Funds" text, "Percentage Change YOY" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the total ...
SELECT COUNT("National Rank") FROM table_30153 WHERE "Percentage Change YOY" = '13.1%'
wikisql
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 HIRE_DATE, SALARY FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE DESC
nvbench
CREATE TABLE medication ( code number, name text, brand text, description text ) CREATE TABLE nurse ( employeeid number, name text, position text, registered boolean, ssn number ) CREATE TABLE procedures ( code number, name text, cost number ) CREATE TABLE trained_in (...
SELECT name FROM procedures WHERE cost < 5000 INTERSECT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen"
spider
CREATE TABLE table_11604804_5 ( founded INTEGER, nickname VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the founding of parsu cimmarons?
SELECT MIN(founded) FROM table_11604804_5 WHERE nickname = "ParSU Cimmarons"
sql_create_context
CREATE TABLE table_204_488 ( id number, "order in\nposition" number, "president of\nthe republic" text, "length of\nthe presidential\naction" text, "rank by\nlength\nof term(s)" number, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who ...
SELECT "president of\nthe republic" FROM table_204_488 WHERE "order in\nposition" < (SELECT "order in\nposition" FROM table_204_488 WHERE "president of\nthe republic" = 'gustaf mannerheim') ORDER BY "order in\nposition" DESC LIMIT 1
squall
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 lab ( subject_id text, hadm_id text, ...
SELECT AVG(demographic.age) FROM demographic WHERE demographic.discharge_location = "HOME HEALTH CARE" AND demographic.diagnosis = "ANGIOEDEMA"
mimicsql_data
CREATE TABLE table_19435 ( "School Year" text, "Class A" text, "Class AA" text, "Class AAA" text, "Class AAAA" text, "Class AAAAA" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For franklin of class aa, which school years does this occur?
SELECT "School Year" FROM table_19435 WHERE "Class AA" = 'Franklin'
wikisql
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugsto...
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355' AND patient.hospitaldischargetime IS NULL)) AND microla...
eicu