instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsysto...
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '006-119203' AND patient.hospitaladmitsource = 'operating room' AND DATETIME(patient.hospitaladmittime) <= DATETIME(CURRENT_TIME(), '-4 year') ORDER BY patient.hospitaladmittime DESC LIMIT 1
eicu
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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), CO...
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY SUM(SALARY) DESC
nvbench
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "76" AND procedures.icd9_code = "3961"
mimicsql_data
CREATE TABLE table_20325360_2 ( rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For the country that holds a rank of 2, in the Mr. International Competition, what is the total number of competitors listed as 2nd runner ups?
SELECT COUNT(2 AS nd_runner_up) FROM table_20325360_2 WHERE rank = 2
sql_create_context
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, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
SELECT zzmzjzjlb.JZZTDM, zzmzjzjlb.JZZTMC FROM zzmzjzjlb WHERE zzmzjzjlb.JZLSH = '23816634375' UNION SELECT fzzmzjzjlb.JZZTDM, fzzmzjzjlb.JZZTMC FROM fzzmzjzjlb WHERE fzzmzjzjlb.JZLSH = '23816634375'
css
CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Tit...
SELECT p.Id AS "post_link", Title, p.Tags AS Tags, p.ViewCount AS "Views", p.Score AS "Score", p.AnswerCount AS "Answers", DATEDIFF(day, p.CreationDate, GETDATE()) AS "Age (days)", p.AcceptedAnswerId AS "Answer Accepted?" FROM Posts AS p WHERE p.AcceptedAnswerId IS NULL AND p.CreationDate >= '20160101' AND (p.Tags LIKE...
sede
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 prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 72198) AND prescriptions.route = 'ih' AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', pres...
mimic_iii
CREATE TABLE table_name_21 ( position_in_table VARCHAR, replaced_by VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Position in Table, when Replaced By is 'Sergio Bueno'?
SELECT position_in_table FROM table_name_21 WHERE replaced_by = "sergio bueno"
sql_create_context
CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER...
SELECT EMP_FNAME, COUNT(EMP_FNAME) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE GROUP BY CRS_DESCRIPTION, EMP_FNAME ORDER BY EMP_FNAME
nvbench
CREATE TABLE table_name_91 ( years_runner_up VARCHAR, runners_up VARCHAR, club VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What years runner-up is Birmingham city, with over 1 runners-up?
SELECT years_runner_up FROM table_name_91 WHERE runners_up > 1 AND club = "birmingham city"
sql_create_context
CREATE TABLE department ( dept_code text, dept_name text, school_code text, emp_num number, dept_address text, dept_extension text ) CREATE TABLE employee ( emp_num number, emp_lname text, emp_fname text, emp_initial text, emp_jobcode text, emp_hiredate time, emp_dob...
SELECT dept_name FROM department ORDER BY dept_name
spider
CREATE TABLE table_67230 ( "Outcome" text, "Date" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the partner for 14 october 2007
SELECT "Partner" FROM table_67230 WHERE "Date" = '14 october 2007'
wikisql
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName te...
SELECT c.UserId AS "user_link", c.Id AS "comment_link", c.CreationDate AS "comment_date", p.Id AS "post_link", c.Text AS Comment FROM Posts AS p INNER JOIN Comments AS c ON c.PostId = p.Id WHERE p.OwnerUserId = '##UserId##' ORDER BY c.CreationDate DESC
sede
CREATE TABLE table_39582 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What week did they have a bye?
SELECT "Week" FROM table_39582 WHERE "Date" = 'bye'
wikisql
CREATE TABLE table_29253 ( "District" text, "Incumbent" text, "Party" text, "Elected" real, "Status" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result of districk georgia's 1st?
SELECT "Result" FROM table_29253 WHERE "District" = 'Georgia''s 1st'
wikisql
CREATE TABLE fgwyjzb ( 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 gwyjzb.MED_ORG_DEPT_CD, gwyjzb.OUT_DIAG_DIS_CD, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '9593496' GROUP BY gwyjzb.MED_ORG_DEPT_CD, gwyjzb.OUT_DIAG_DIS_CD UNION SELECT fgwyjzb.MED_ORG_DEPT_CD, fgwyjzb.OUT_DIAG_DIS_CD, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '95...
css
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 FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '张兴昌' AND t_kc22.MED_INV_ITEM_TYPE = '治疗费'
css
CREATE TABLE table_name_35 ( home_team VARCHAR, tie_no VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Home team of Tie no 40?
SELECT home_team FROM table_name_35 WHERE tie_no = "40"
sql_create_context
CREATE TABLE table_name_21 ( position VARCHAR, season VARCHAR, level VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Position has a Season larger than 2000 with a Level of Tier 3?
SELECT position FROM table_name_21 WHERE season > 2000 AND level = "tier 3"
sql_create_context
CREATE TABLE table_name_87 ( league INTEGER, total VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which League Cup that has a Total of 19 and a League smaller than 15?
SELECT AVG(league) AS Cup FROM table_name_87 WHERE total = 19 AND league < 15
sql_create_context
CREATE TABLE table_80097 ( "Round" text, "Date" text, "Opponent" text, "Venue" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average attendance at a game held at Firhill for the 5(r) round?
SELECT AVG("Attendance") FROM table_80097 WHERE "Venue" = 'firhill' AND "Round" = '5(r)'
wikisql
CREATE TABLE table_50871 ( "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_50871 WHERE "Game" = '70'
wikisql
CREATE TABLE directed_by ( id int, msid int, did int ) CREATE TABLE cast ( id int, msid int, aid int, role text ) CREATE TABLE director ( did int, gender text, name text, nationality text, birth_city text, birth_year int ) CREATE TABLE copyright ( id int, m...
SELECT name FROM actor WHERE birth_city = 'Austin' AND gender = 'female'
imdb
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 BumpCount, COUNT(*) AS NumberOfQuestionsBumped FROM (SELECT P.Id, B.BumpCount FROM Posts AS P JOIN (SELECT PostId, COUNT(*) AS BumpCount FROM PostHistory WHERE PostHistoryTypeId = 50 GROUP BY PostId HAVING COUNT(*) > 2) AS B ON P.Id = B.PostId) AS RawBumpCounts GROUP BY BumpCount ORDER BY BumpCount
sede
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE treatment ( trea...
SELECT COUNT(*) FROM medication WHERE medication.drugname = 'sodium chloride 0.9 % iv soln bolus' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
eicu
CREATE TABLE table_41492 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-10" real, "Top-25" real, "Events" real, "Cuts made" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of Events, when Top-10 is 7, and when Top-5 is g...
SELECT SUM("Events") FROM table_41492 WHERE "Top-10" = '7' AND "Top-5" > '4'
wikisql
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 zyjzjlb.JZLSH 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 NOT zyjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ >= '2019-11-18')
css
CREATE TABLE table_80279 ( "Year" real, "Competition" text, "Wins" real, "Draws" real, "Loses" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What average Wins has Losses 2, and Draws less than 0?
SELECT AVG("Wins") FROM table_80279 WHERE "Loses" = '2' AND "Draws" < '0'
wikisql
CREATE TABLE table_56120 ( "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. -- How many people attended the game with an away t...
SELECT COUNT("Crowd") FROM table_56120 WHERE "Away team score" = '10.8 (68)'
wikisql
CREATE TABLE table_name_67 ( position VARCHAR, pick VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the position of pick 234
SELECT position FROM table_name_67 WHERE pick = "234"
sql_create_context
CREATE TABLE Institution ( Institution_id text, Institution text, Location text, Founded real, Type text, Enrollment int, Team text, Primary_Conference text, building_id text ) CREATE TABLE building ( building_id text, Name text, Street_address text, Years_as_tallest...
SELECT Name, COUNT(*) FROM building AS T1 JOIN Institution AS T2 ON T1.building_id = T2.building_id GROUP BY T1.building_id ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_50226 ( "Department" text, "Micro (10ha)" real, "Small (100ha)" real, "Medium (500ha)" real, "Big (>500ha)" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Small (100ha) is the highest one that has a Big (>5...
SELECT MAX("Small (100ha)") FROM table_50226 WHERE "Big (>500ha)" > '9,021'
wikisql
CREATE TABLE table_203_654 ( id number, "position" number, "team" text, "points" number, "played" number, "won" number, "drawn" number, "lost" number, "for" number, "against" number, "difference" number ) -- Using valid SQLite, answer the following questions for the tables ...
SELECT "points" FROM table_203_654 WHERE "team" = 'auto'
squall
CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE cours...
SELECT DISTINCT advisory_requirement FROM course WHERE department = 'ENGR' AND number = 996
advising
CREATE TABLE table_203_507 ( id number, "#" text, "player" text, "\u03c3 points" number, "qual." number, "final" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many players had a 8 points ?
SELECT COUNT("player") FROM table_203_507 WHERE "\u03c3 points" = 8
squall
CREATE TABLE Subjects ( subject_id INTEGER, subject_name VARCHAR(120) ) CREATE TABLE Student_Course_Enrolment ( registration_id INTEGER, student_id INTEGER, course_id INTEGER, date_of_enrolment DATETIME, date_of_completion DATETIME ) CREATE TABLE Course_Authors_and_Tutors ( author_id I...
SELECT date_of_enrolment, COUNT(date_of_enrolment) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "Spanish"
nvbench
CREATE TABLE table_72424 ( "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. -- What is the result for thomas s. mcmillan?
SELECT "Result" FROM table_72424 WHERE "Incumbent" = 'Thomas S. McMillan'
wikisql
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_kc22.DIRE_TYPE FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '68648180583' AND t_kc22.SOC_SRT_DIRE_NM = '复方聚乙二醇电解质散'
css
CREATE TABLE table_name_1 ( record VARCHAR, event VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Record has an Event of inoki bom-ba-ye 2002?
SELECT record FROM table_name_1 WHERE event = "inoki bom-ba-ye 2002"
sql_create_context
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 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-19622')) AND microlab.culturesite = 'bronchial lavage' AND DA...
eicu
CREATE TABLE table_20170644_1 ( cfl_team VARCHAR, position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What team was in position OL?
SELECT cfl_team FROM table_20170644_1 WHERE position = "OL"
sql_create_context
CREATE TABLE certificate ( eid number(9,0), aid number(9,0) ) CREATE TABLE employee ( eid number(9,0), name varchar2(30), salary number(10,2) ) CREATE TABLE flight ( flno number(4,0), origin varchar2(20), destination varchar2(20), distance number(6,0), departure_date date, ...
SELECT name, distance FROM aircraft ORDER BY name DESC
nvbench
CREATE TABLE table_name_15 ( competition VARCHAR, first_match VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What competition had its first match on December 20, 2007?
SELECT competition FROM table_name_15 WHERE first_match = "december 20, 2007"
sql_create_context
CREATE TABLE table_name_39 ( home_team VARCHAR, crowd INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score of the home team when there were more than 5,500 people in the crowd?
SELECT home_team AS score FROM table_name_39 WHERE crowd > 5 OFFSET 500
sql_create_context
CREATE TABLE table_name_90 ( rank INTEGER, director VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average rank for the film directed by michael bay?
SELECT AVG(rank) FROM table_name_90 WHERE director = "michael bay"
sql_create_context
CREATE TABLE table_64745 ( "Rank" text, "Province" text, "Population (2011)" real, "Percentage" real, "Population Estimate (2013)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the rank of the gauteng province?
SELECT "Rank" FROM table_64745 WHERE "Province" = 'gauteng'
wikisql
CREATE TABLE phone ( Name text, Phone_ID int, Memory_in_G int, Carrier text, Price real ) CREATE TABLE market ( Market_ID int, District text, Num_of_employees int, Num_of_shops real, Ranking int ) CREATE TABLE phone_market ( Market_ID int, Phone_ID text, Num_of_stoc...
SELECT Carrier, AVG(Memory_in_G) FROM phone GROUP BY Carrier ORDER BY AVG(Memory_in_G) DESC
nvbench
CREATE TABLE table_name_12 ( Id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the 2007 value for the 2010 wta premier 5 tournaments?
SELECT 2007 FROM table_name_12 WHERE 2010 = "wta premier 5 tournaments"
sql_create_context
CREATE TABLE table_name_99 ( streak VARCHAR, stadium VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the streak at the game at the Miami Orange Bowl?
SELECT streak FROM table_name_99 WHERE stadium = "miami orange bowl"
sql_create_context
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), ...
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY HIRE_DATE
nvbench
CREATE TABLE category ( id int, business_id varchar, category_name varchar ) CREATE TABLE user ( uid int, user_id varchar, name varchar ) CREATE TABLE tip ( tip_id int, business_id varchar, text longtext, user_id varchar, likes int, year int, month varchar ) CREATE...
SELECT business.name FROM business, category WHERE business.city = 'Los Angeles' AND business.review_count >= 30 AND category.business_id = business.business_id AND category.category_name = 'Bars'
yelp
CREATE TABLE table_204_206 ( id number, "saros" number, "member" number, "date" text, "time\n(greatest)\nutc" text, "type" text, "location\nlat,long" text, "gamma" number, "mag." number, "width\n(km)" number, "duration\n(min:sec)" text, "ref" number ) -- Using valid SQL...
SELECT ABS((SELECT "mag." FROM table_204_206 WHERE "date" = 'may 13, 2181') - (SELECT "mag." FROM table_204_206 WHERE "date" = 'may 24, 2199'))
squall
CREATE TABLE table_name_59 ( locomotive VARCHAR, operator VARCHAR, entered_service VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Locomotive Entered Service in November 1984 and has an Operator of Southern Shorthaul Railroad?
SELECT locomotive FROM table_name_59 WHERE operator = "southern shorthaul railroad" AND entered_service = "november 1984"
sql_create_context
CREATE TABLE table_48697 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of departure" text, "Incoming manager" text, "Date hired" text, "Position in table" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the...
SELECT "Outgoing manager" FROM table_48697 WHERE "Team" = 'necaxa'
wikisql
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.language = "SPAN" AND demographic.admission_location = "PHYS REFERRAL/NORMAL DELI"
mimicsql_data
CREATE TABLE culture_company ( company_name text, type text, incorporated_in text, group_equity_shareholding number, book_club_id text, movie_id text ) CREATE TABLE book_club ( book_club_id number, year number, author_or_editor text, book_title text, publisher text, cate...
SELECT COUNT(*) FROM book_club
spider
CREATE TABLE table_59403 ( "State" text, "Born/Died" text, "Active service" text, "Chief Judge" text, "Senior status" text, "Appointed by" text, "Reason for termination" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Chief Judge has Ac...
SELECT "Chief Judge" FROM table_59403 WHERE "Active service" = '1873–1875'
wikisql
CREATE TABLE table_38308 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the Loss for the game that had a 22-24 record?
SELECT "Loss" FROM table_38308 WHERE "Record" = '22-24'
wikisql
CREATE TABLE table_36142 ( "Candidate" text, "Party" text, "EU Party" text, "1st count" real, "29th count" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which candidate's party is pl when the 29th count is 39,250?
SELECT "Candidate" FROM table_36142 WHERE "Party" = 'pl' AND "29th count" = '39,250'
wikisql
CREATE TABLE table_14003020_5 ( lowest INTEGER, highest VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the minimum lowest with highest being 2363
SELECT MIN(lowest) FROM table_14003020_5 WHERE highest = 2363
sql_create_context
CREATE TABLE table_203_370 ( id number, "year" number, "competition" text, "venue" text, "position" text, "event" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what are the total number of times the position of 1st place was e...
SELECT COUNT(*) FROM table_203_370 WHERE "position" = 1
squall
CREATE TABLE table_14937 ( "Heat" real, "Lane" real, "Name" text, "Nationality" text, "Time" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was from Great Britain in lane 5?
SELECT "Name" FROM table_14937 WHERE "Nationality" = 'great britain' AND "Lane" = '5'
wikisql
CREATE TABLE table_name_45 ( nhl_team VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What NHL team does Rob White play on?
SELECT nhl_team FROM table_name_45 WHERE player = "rob white"
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 jybgb.KSBM, jybgb.KSMC FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb 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 WHERE person_info.XM = '蒋...
css
CREATE TABLE table_15780049_6 ( location_attendance VARCHAR, game VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the location and what is the attendance of game 38?
SELECT location_attendance FROM table_15780049_6 WHERE game = 38
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.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.discharge_location = "HOME"
mimicsql_data
CREATE TABLE table_name_64 ( high_assists VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the High assists when the record was 28 40?
SELECT high_assists FROM table_name_64 WHERE record = "28–40"
sql_create_context
CREATE TABLE table_203_573 ( id number, "name" text, "rank - 2000" number, "number" number, "country of origin" text, "england - 2001" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which surname on the list belongs to the smallest number of peo...
SELECT "name" FROM table_203_573 ORDER BY "number" LIMIT 1
squall
CREATE TABLE table_34944 ( "Date" text, "Opponent#" text, "Site" text, "Result" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Attendance on 11/10/1928?
SELECT "Attendance" FROM table_34944 WHERE "Date" = '11/10/1928'
wikisql
CREATE TABLE table_50890 ( "Institution" text, "Location" text, "Founded" real, "Affiliation" text, "Enrollment" real, "Nickname" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Affiliation, when Nickname is Bulldogs?
SELECT "Affiliation" FROM table_50890 WHERE "Nickname" = 'bulldogs'
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.gender, diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "2560"
mimicsql_data
CREATE TABLE table_25165 ( "Rank" real, "1980-81" text, "1981-82" text, "1982-83" text, "1983-84" text, "1984-85" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is every entry for 1980-81 when 1984-85 is Liz Alvarado?
SELECT "1980-81" FROM table_25165 WHERE "1984-85" = 'Liz Alvarado'
wikisql
CREATE TABLE Claims ( Claim_ID INTEGER, Policy_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER, Amount_Settled INTEGER ) CREATE TABLE Payments ( Payment_ID INTEGER, Settlement_ID INTEGER, Payment_Method_Code VARCHAR(255), Date_Payment_Made DATE,...
SELECT Date_Payment_Made, COUNT(Date_Payment_Made) FROM Payments WHERE Payment_Method_Code = 'Visa' ORDER BY COUNT(Date_Payment_Made) DESC
nvbench
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsysto...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE STRFTIME('%y', patient.hospitaladmittime) <= '2100'
eicu
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE cost ( costid num...
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 = '018-118331')) AND treatment.treatmentname = 'analgesics - non-narcotoc analg...
eicu
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, Deletio...
SELECT u.Id, AVG(u.Reputation) AS Reputation, AVG(u.UpVotes) AS UpVotes, AVG(u.DownVotes) AS DownVotes, AVG(p.Score) AS Score, AVG(p.ViewCount) AS ViewCount FROM Users AS u INNER JOIN Posts AS p ON u.Id = p.OwnerUserId GROUP BY u.Id
sede
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 COUNT(*) FROM mzjzjlb WHERE YLJGDM = '2301260' AND JZKSRQ BETWEEN '2007-01-04' AND '2020-10-03' AND ZSEBZ > 0
css
CREATE TABLE LOTS ( lot_details VARCHAR, investor_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Return the lot details and investor ids.
SELECT lot_details, investor_id FROM LOTS
sql_create_context
CREATE TABLE management ( department_ID int, head_ID int, temporary_acting text ) CREATE TABLE department ( Department_ID int, Name text, Creation text, Ranking int, Budget_in_Billions real, Num_Employees real ) CREATE TABLE head ( head_ID int, name text, born_state tex...
SELECT Creation, SUM(Budget_in_Billions) FROM department ORDER BY Creation DESC
nvbench
CREATE TABLE table_name_82 ( avg_g VARCHAR, gp_gs VARCHAR, effic VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Avg/G that has a GP-GS of 13 13, and a Effic smaller than 114.23 has what total of numbers?
SELECT COUNT(avg_g) FROM table_name_82 WHERE gp_gs = "13–13" AND effic < 114.23
sql_create_context
CREATE TABLE table_186468_1 ( v_band VARCHAR, k_band VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When 5.5 is the l-band what is the v-band?
SELECT v_band FROM table_186468_1 WHERE k_band = "5.5"
sql_create_context
CREATE TABLE table_name_5 ( opponent VARCHAR, opponents VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the opponent with 16 points?
SELECT opponent FROM table_name_5 WHERE opponents = 16
sql_create_context
CREATE TABLE table_name_95 ( nation VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What nation has a Record of 5.06m(16ft7in)?
SELECT nation FROM table_name_95 WHERE record = "5.06m(16ft7in)"
sql_create_context
CREATE TABLE table_7291 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many people attended the game played with the New England Patriots as opponents?
SELECT "Attendance" FROM table_7291 WHERE "Opponent" = 'new england patriots'
wikisql
CREATE TABLE table_51999 ( "Date of Issue" text, "Denomination" text, "Design" text, "Paper Type" text, "First Day Cover Cancellation" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the paper type that the one that was issued on 26 july 2007...
SELECT "Paper Type" FROM table_51999 WHERE "Date of Issue" = '26 july 2007'
wikisql
CREATE TABLE table_name_85 ( score_in_the_final VARCHAR, opponents_in_the_final VARCHAR, partner VARCHAR, outcome VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the Score which has a Partner of jorge lozano, an Outcome of runner-up, and Opponent...
SELECT score_in_the_final FROM table_name_85 WHERE partner = "jorge lozano" AND outcome = "runner-up" AND opponents_in_the_final = "udo riglewski michael stich"
sql_create_context
CREATE TABLE table_10312547_1 ( character VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who played Peter Pan in the 1990 Broadway?
SELECT 1990 AS _broadway FROM table_10312547_1 WHERE character = "Peter Pan"
sql_create_context
CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) ...
SELECT Nationality, AVG(ID) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC
nvbench
CREATE TABLE table_63104 ( "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 number of silver when the total is more than 2, and bronze is less than 3, with ...
SELECT COUNT("Silver") FROM table_63104 WHERE "Total" > '2' AND "Bronze" < '3' AND "Rank" = '7'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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...
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE wdmzjzjlb.JZZDSM = '由于使用酒精引起的精神病性障碍' AND jyjgzbb.JCZBDM = '172184' UNION SELECT jyjgzb...
css
CREATE TABLE table_9118 ( "Club" text, "Played" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text, "Losing bonus" text, "Points" text ) -- Using valid SQLite, answer the following questions fo...
SELECT "Tries for" FROM table_9118 WHERE "Club" = 'club'
wikisql
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 COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN"
mimicsql_data
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, ...
SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14502 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 ...
mimic_iii
CREATE TABLE table_name_60 ( draws INTEGER, result VARCHAR, losses VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the smallest Draws with a Result of runner-up, and Losses larger than 1?
SELECT MIN(draws) FROM table_name_60 WHERE result = "runner-up" AND losses > 1
sql_create_context
CREATE TABLE table_name_72 ( time VARCHAR, loss VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Time is listed for the Loss of Okajima (1-2)?
SELECT time FROM table_name_72 WHERE loss = "okajima (1-2)"
sql_create_context
CREATE TABLE table_name_32 ( round INTEGER, time VARCHAR, event VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- At the UFC 78, what is the average round when the time is 5:00?
SELECT AVG(round) FROM table_name_32 WHERE time = "5:00" AND event = "ufc 78"
sql_create_context
CREATE TABLE table_45354 ( "Rank" text, "Badge/Serial Number" text, "Tenure" text, "Date of death" text, "Cause of death" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Badge/Serial Number of the Policeman who died in Gunfire on 1919-02-...
SELECT "Badge/Serial Number" FROM table_45354 WHERE "Rank" = 'policeman' AND "Cause of death" = 'gunfire' AND "Date of death" = '1919-02-18'
wikisql
CREATE TABLE table_16781 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many millions ...
SELECT "U.S. viewers (millions)" FROM table_16781 WHERE "Written by" = 'Krystal Houghton'
wikisql
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "16" AND prescriptions.drug = "Prismasate (B32 K2)"
mimicsql_data
CREATE TABLE table_name_12 ( losing_bonus VARCHAR, try_bonus VARCHAR, tries_for VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the losing bonus for the team with a try bonus of 3 and 47 tries for?
SELECT losing_bonus FROM table_name_12 WHERE try_bonus = "3" AND tries_for = "47"
sql_create_context