instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE program ( program_id int, name varchar...
SELECT COUNT(DISTINCT instructor.instructor_id) FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'AAPTIS' AND course.number = 838 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.off...
advising
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number...
SELECT COUNT(*) FROM Users WHERE LastAccessDate >= '2018-07-26'
sede
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.USE_FRE, t_kc22.EACH_DOSAGE 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 = '47484689413' AND t_kc22.SOC_SRT_DIRE_NM = '多潘立酮片'
css
CREATE TABLE table_name_76 ( metacritic VARCHAR, gamerankings VARCHAR, year_released VARCHAR, platform VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Metacritic released after 2005, with a Platform of playstation 3 and a GameRankings of 8...
SELECT metacritic FROM table_name_76 WHERE year_released > 2005 AND platform = "playstation 3" AND gamerankings = "84.44%"
sql_create_context
CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE paperfield ( fieldid int, pape...
SELECT DISTINCT COUNT(paper.paperid) FROM journal, paper, paperkeyphrase WHERE journal.journalname = 'Cell' AND paper.journalid = journal.journalid AND paper.paperid = paperkeyphrase.paperid AND paper.year = 2016
scholar
CREATE TABLE table_name_50 ( outcome VARCHAR, surface VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which outcome has a Surface of clay and a Score of 4 6, 7 5, 2 6?
SELECT outcome FROM table_name_50 WHERE surface = "clay" AND score = "4–6, 7–5, 2–6"
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.discharge_location = "LEFT AGAINST MEDICAL ADVI" AND diagnoses.short_title = "Blood in stool"
mimicsql_data
CREATE TABLE table_54593 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many attended tie number 1?
SELECT SUM("Attendance") FROM table_54593 WHERE "Tie no" = '1'
wikisql
CREATE TABLE table_48149 ( "Missouri vs." text, "Overall Record" text, "at Columbia" text, "at Opponent's Venue" text, "at Neutral Site" text, "Last 5 Meetings" text, "Last 10 Meetings" text, "Current Streak" text, "Since Joining SEC" text ) -- Using valid SQLite, answer the follow...
SELECT "at Opponent's Venue" FROM table_48149 WHERE "Missouri vs." = 'tennessee'
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 jyjgzbb.JYZBLSH 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 = ...
css
CREATE TABLE table_name_47 ( spoofed_title VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Spoofed title is from February 1998?
SELECT spoofed_title FROM table_name_47 WHERE date = "february 1998"
sql_create_context
CREATE TABLE airlines ( alid number, name text, iata text, icao text, callsign text, country text, active text ) CREATE TABLE routes ( rid number, dst_apid number, dst_ap text, src_apid number, src_ap text, alid number, airline text, codeshare text ) CREATE ...
SELECT COUNT(*) FROM airlines
spider
CREATE TABLE table_name_72 ( name VARCHAR, location VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which is located in Nigeria?
SELECT name FROM table_name_72 WHERE location = "nigeria"
sql_create_context
CREATE TABLE table_12280 ( "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 date was the game with the away team york city?
SELECT "Date" FROM table_12280 WHERE "Away team" = 'york city'
wikisql
CREATE TABLE table_204_36 ( id number, "date" text, "opponent" text, "site" text, "result" text, "attendance" number, "record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many games did the hoyas score 50 or more points ?
SELECT COUNT(*) FROM table_204_36 WHERE "result" >= 50
squall
CREATE TABLE table_10647401_1 ( week INTEGER, stadium VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What week corresponds to the last one to be played at the memorial stadium?
SELECT MAX(week) FROM table_10647401_1 WHERE stadium = "Memorial stadium"
sql_create_context
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, ...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'LOS ANGELES' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PI...
atis
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 WHERE demographic.marital_status = "SINGLE" AND demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN"
mimicsql_data
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 regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(4...
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
nvbench
CREATE TABLE table_name_56 ( title VARCHAR, director VARCHAR, release_date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which title was directed by chuck jones and released on 1958-04-12?
SELECT title FROM table_name_56 WHERE director = "chuck jones" AND release_date = "1958-04-12"
sql_create_context
CREATE TABLE table_name_58 ( crowd INTEGER, home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many people attended the home game for South Melbourne?
SELECT SUM(crowd) FROM table_name_58 WHERE home_team = "south melbourne"
sql_create_context
CREATE TABLE table_61744 ( "Conflicts prior to Israel's independence" text, "Military deaths" text, "Civilian deaths" text, "Total deaths" text, "Military and/or Civilian wounded" text, "Total casualties" text ) -- Using valid SQLite, answer the following questions for the tables provided abov...
SELECT "Military deaths" FROM table_61744 WHERE "Military and/or Civilian wounded" = '1,200+'
wikisql
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TA...
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-66713')) AND intakeoutput.cellpath LIKE '%intake%...
eicu
CREATE TABLE Departments ( department_id INTEGER, dept_store_id INTEGER, department_name VARCHAR(80) ) CREATE TABLE Suppliers ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80) ) CREATE TABLE Supplier_Addresses ( supplier_id INTEGER, address_id INTEGER, da...
SELECT product_type_code, MIN(product_price) FROM Products GROUP BY product_type_code ORDER BY MIN(product_price)
nvbench
CREATE TABLE table_64444 ( "Rank" real, "Player" text, "County" text, "Tally" text, "Total" real, "Opposition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the opposition for the player who has a total of 10 points?
SELECT "Opposition" FROM table_64444 WHERE "Total" = '10'
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 jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN mzjzjlb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jyjgzbb.jybgb_YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jyjgzbb.jybgb_JZLSH_MZJZJLB WHERE jyjgzbb.JYRQ BETWEEN '2001-03-09' AND '2008-03-1...
css
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, value...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FR...
mimic_iii
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number...
SELECT * FROM Posts WHERE CreationDate BETWEEN '2015-12-01 00:00:01' AND '2015-12-31 11:59:59'
sede
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time...
SELECT a.OwnerUserId AS "user_link", CAST(DATE(0, 'AVG(CAST((JULIANDAY(CreationDate) - JULIANDAY(q.CreationDate)) * 86400.0 AS INTEGER)) SECOND') AS TIMESTAMP), COUNT(*) FROM Posts AS a INNER JOIN Posts AS q ON a.ParentId = q.Id WHERE a.PostTypeId = 2 AND NOT a.OwnerUserId IS NULL AND (q.OwnerUserId IS NULL OR q.OwnerU...
sede
CREATE TABLE qtb ( CLINIC_ID 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, INSU_TYPE text, IN...
SELECT qtb.OUT_DIAG_DOC_CD, qtb.OUT_DIAG_DOC_NM FROM qtb WHERE qtb.PERSON_NM = '窦湛蓝' AND qtb.IN_HOSP_DATE BETWEEN '2004-12-07' AND '2017-09-13' GROUP BY qtb.OUT_DIAG_DOC_CD ORDER BY COUNT(*) DESC LIMIT 1 UNION SELECT gyb.OUT_DIAG_DOC_CD, gyb.OUT_DIAG_DOC_NM FROM gyb WHERE gyb.PERSON_NM = '窦湛蓝' AND gyb.IN_HOSP_DATE BETW...
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 gwyjzb.MED_ORG_DEPT_NM, gwyjzb.IN_DIAG_DIS_CD, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '6776631' GROUP BY gwyjzb.MED_ORG_DEPT_NM, gwyjzb.IN_DIAG_DIS_CD UNION SELECT fgwyjzb.MED_ORG_DEPT_NM, fgwyjzb.IN_DIAG_DIS_CD, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '67766...
css
CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilege...
SELECT COUNT(Id) FROM Users WHERE Reputation >= 150
sede
CREATE TABLE table_380 ( "Member" text, "Electorate" text, "Province" text, "MPs term" text, "Election date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what's the province where member is dingley brittin category:articles with hcards
SELECT "Province" FROM table_380 WHERE "Member" = 'Dingley Brittin Category:Articles with hCards'
wikisql
CREATE TABLE table_57926 ( "Episode" text, "Air Date" text, "Rating" real, "Share" real, "Rating/Share 18\u201349" text, "Viewers (m)" real, "Timeslot Rank" real, "Night Rank" text, "Overall Rank" real ) -- Using valid SQLite, answer the following questions for the tables provided ...
SELECT COUNT("Overall Rank") FROM table_57926 WHERE "Rating/Share 18\u201349" = '4.5/11' AND "Rating" < '8.2'
wikisql
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 medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '022-6959') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT medication.drugname FROM medicat...
eicu
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE Posts ( Id number, PostTypeId number, Accepted...
SELECT p.Id AS "post_link", SUM(v.PostId) AS downVotes FROM Posts AS p INNER JOIN PostTypes AS pt ON pt.Id = p.PostTypeId INNER JOIN Votes AS v ON v.PostId = p.Id INNER JOIN VoteTypes AS vt ON vt.Id = v.VoteTypeId WHERE p.OwnerUserId = '##UserId##' AND vt.Id = 3 AND p.PostTypeId = 1 GROUP BY p.Id
sede
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
SELECT FLX_MED_ORG_ID FROM t_kc21 WHERE MED_CLINIC_ID = '06309706061'
css
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 qtb.MED_ORG_DEPT_NM, qtb.OUT_DIAG_DIS_NM, AVG(qtb.PERSON_AGE) FROM qtb WHERE qtb.MED_SER_ORG_NO = '3290779' GROUP BY qtb.MED_ORG_DEPT_NM, qtb.OUT_DIAG_DIS_NM HAVING AVG(qtb.PERSON_AGE) > 29 UNION SELECT gyb.MED_ORG_DEPT_NM, gyb.OUT_DIAG_DIS_NM, AVG(gyb.PERSON_AGE) FROM gyb WHERE gyb.MED_SER_ORG_NO = '3290779' GR...
css
CREATE TABLE table_30214 ( "Draw" real, "Artist" text, "Song (English translation)" text, "Lyrics (l) / Music (m)" text, "Juries" real, "Viewers" real, "Total" real, "Place" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many juries ...
SELECT MAX("Juries") FROM table_30214 WHERE "Draw" = '3'
wikisql
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, sh...
SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15794 AND admissions.dischtime IS NULL)) AND chartevents.itemid IN (SELECT d_items.itemid FROM...
mimic_iii
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.language = "ENGL" AND lab.label = "Creatine Kinase, MB Isoenzyme"
mimicsql_data
CREATE TABLE table_15143 ( "Name" text, "Design" text, "Manufacturer" text, "Acquired" real, "Disposed" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What design was acquired in 1875?
SELECT "Design" FROM table_15143 WHERE "Acquired" = '1875'
wikisql
CREATE TABLE table_53687 ( "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. -- Who was the home team that scored 19.18 (132)?
SELECT "Home team" FROM table_53687 WHERE "Home team score" = '19.18 (132)'
wikisql
CREATE TABLE table_14951 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the home team of the game on December 21?
SELECT "Home" FROM table_14951 WHERE "Date" = 'december 21'
wikisql
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.admission_type = "ELECTIVE" AND lab.label = "Epithelial Cells"
mimicsql_data
CREATE TABLE table_22064 ( "Story No." text, "Episode" real, "Title" text, "Directed by" text, "Written by" text, "UK viewers (million)" text, "AI (%)" real, "Original air date" text, "Production code" text ) -- Using valid SQLite, answer the following questions for the tables prov...
SELECT "Story No." FROM table_22064 WHERE "Written by" = 'Paul Cornell'
wikisql
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardi...
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, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissi...
mimic_iii
CREATE TABLE table_1777 ( "Parish ( Prestegjeld )" text, "Sub-Parish (Sokn)" text, "Church Name" text, "Year Built" real, "Location of the Church" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the location of the church for berle kyrkje
SELECT "Location of the Church" FROM table_1777 WHERE "Church Name" = 'Berle kyrkje'
wikisql
CREATE TABLE table_30194 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the title of episo...
SELECT "Title" FROM table_30194 WHERE "No. in series" = '155'
wikisql
CREATE TABLE table_name_67 ( week_1 VARCHAR, week_3 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the week 3 of 36
SELECT week_1 FROM table_name_67 WHERE week_3 = "36"
sql_create_context
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, sy...
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, COUNT(treatment.treatmenttime) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid ...
eicu
CREATE TABLE table_37939 ( "Round" real, "Pick #" real, "Overall" real, "Name" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which highest pick number's name was Adam Podlesh, when the overall was less than 101?...
SELECT MAX("Pick #") FROM table_37939 WHERE "Name" = 'adam podlesh' AND "Overall" < '101'
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 COUNT(*) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_NM = '俞英卓' AND t_kc22.STA_DATE BETWEEN '2011-12-30' AND '2015-04-15' AND t_kc22.MED_INV_ITEM_TYPE = '西药费' UNION SELECT COUNT(*) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE fgwyjz...
css
CREATE TABLE table_22828 ( "DMA" real, "Market" text, "Station" text, "Frequency" text, "Branding" text, "Format" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which station has the frequency of 107.3?
SELECT "Station" FROM table_22828 WHERE "Frequency" = '107.3'
wikisql
CREATE TABLE table_4525 ( "Name" text, "Pole Position" text, "Fastest Lap" text, "Winning driver" text, "Winning team" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who did Teo Fabi drive for when he won and had pole position?
SELECT "Winning team" FROM table_4525 WHERE "Winning driver" = 'teo fabi' AND "Pole Position" = 'teo fabi'
wikisql
CREATE TABLE table_name_56 ( away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score when the away team was Collingwood?
SELECT away_team AS score FROM table_name_56 WHERE away_team = "collingwood"
sql_create_context
CREATE TABLE table_name_71 ( diameter INTEGER, longitude VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the lowest diameter when the longitude is 71.1w?
SELECT MIN(diameter) FROM table_name_71 WHERE longitude = "71.1w"
sql_create_context
CREATE TABLE table_45167 ( "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. -- Which ...
SELECT "Team" FROM table_45167 WHERE "High rebounds" = 'tyson chandler (7)'
wikisql
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, ...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of ye...
mimic_iii
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE fzzmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, ...
SELECT * FROM hz_info JOIN zzmzjzjlb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX WHERE hz_info.RYBH = '04455332' AND hz_info.YLJGDM = '0621051' AND zzmzjzjlb.JZZDSM LIKE '%形式%' UNION SELECT * FROM hz_info JOIN fzzmzjzjlb ON hz_info.YLJGDM = fzzmzjzjlb.YLJGDM AND hz...
css
CREATE TABLE table_71525 ( "Year" text, "Start" text, "Qual" text, "Rank" text, "Finish" text, "Laps" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which year did Tony Bettenhausen complete more than 200 laps?
SELECT "Year" FROM table_71525 WHERE "Laps" > '200'
wikisql
CREATE TABLE manufacturer ( manufacturer_id number, open_year number, name text, num_of_factories number, num_of_shops number ) CREATE TABLE furniture_manufacte ( manufacturer_id number, furniture_id number, price_in_dollar number ) CREATE TABLE furniture ( furniture_id number, ...
SELECT AVG(num_of_factories) FROM manufacturer WHERE num_of_shops > 20
spider
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following questions for the...
SELECT T2.Name, AVG(T1.Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY AVG(T1.Price) DESC
nvbench
CREATE TABLE Actual_Orders ( actual_order_id INTEGER, order_status_code VARCHAR(10), regular_order_id INTEGER, actual_order_date DATETIME ) CREATE TABLE Customers ( customer_id INTEGER, payment_method VARCHAR(10), customer_name VARCHAR(80), customer_phone VARCHAR(80), customer_email...
SELECT state_province_county, COUNT(*) FROM Customer_Addresses AS t1 JOIN Addresses AS t2 ON t1.address_id = t2.address_id GROUP BY t2.state_province_county ORDER BY COUNT(*)
nvbench
CREATE TABLE table_24689168_5 ( episode VARCHAR, viewers__millions_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what episode number had 11.73 million viewers?
SELECT episode FROM table_24689168_5 WHERE viewers__millions_ = "11.73"
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 COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-18150')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutpu...
eicu
CREATE TABLE table_name_86 ( starts INTEGER, wins INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On average, how many Starts have Wins that are smaller than 0?
SELECT AVG(starts) FROM table_name_86 WHERE wins < 0
sql_create_context
CREATE TABLE gas_station ( station_id VARCHAR, LOCATION VARCHAR, manager_name VARCHAR, open_year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show gas station id, location, and manager_name for all gas stations ordered by open year.
SELECT station_id, LOCATION, manager_name FROM gas_station ORDER BY open_year
sql_create_context
CREATE TABLE table_name_34 ( against INTEGER, difference VARCHAR, lost VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which average's against score has 2 as a difference and a lost of 5?
SELECT AVG(against) FROM table_name_34 WHERE difference = "2" AND lost = 5
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate n...
SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'pulmicort respule' AND patient.uniquepid = '002-59265') AS t1 JOIN (SELECT patient.uniquepid, medication.drugstarttime FR...
eicu
CREATE TABLE county ( Population INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show the average population of all counties.
SELECT AVG(Population) FROM county
sql_create_context
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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "NEO*IV*AMPicillin Sodium"
mimicsql_data
CREATE TABLE table_7916 ( "Name" text, "League" real, "FA Cup" real, "League Cup" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the total when the league is less than 1?
SELECT "Total" FROM table_7916 WHERE "League" < '1'
wikisql
CREATE TABLE table_39624 ( "Name" text, "Livery" text, "Arrival" real, "Type" text, "Configuration" text, "Builder" text, "Built" real, "Status" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- for type diesel-mechanic...
SELECT "Status" FROM table_39624 WHERE "Configuration" = 'b-b' AND "Type" = 'diesel-mechanical'
wikisql
CREATE TABLE table_name_3 ( speed VARCHAR, construction_begun VARCHAR, expected_start_of_revenue_services VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Speed when Construction begun in 2010, and an Expected start of revenue services of 2015?...
SELECT speed FROM table_name_3 WHERE construction_begun = "2010" AND expected_start_of_revenue_services = 2015
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( ...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.diagnosis = "POSTERIOR COMMUNICATING ANEURYSM/SDA"
mimicsql_data
CREATE TABLE Financial_Transactions ( transaction_id INTEGER, previous_transaction_id INTEGER, account_id INTEGER, card_id INTEGER, transaction_type VARCHAR(15), transaction_date DATETIME, transaction_amount DOUBLE, transaction_comment VARCHAR(255), other_transaction_details VARCHAR(...
SELECT customer_last_name, COUNT(customer_last_name) FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id GROUP BY customer_last_name ORDER BY COUNT(customer_last_name) DESC
nvbench
CREATE TABLE table_name_60 ( away_team VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What away team plays at Victoria Park?
SELECT away_team FROM table_name_60 WHERE venue = "victoria park"
sql_create_context
CREATE TABLE table_18389 ( "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 district did Joe Waggonner belong to?
SELECT "District" FROM table_18389 WHERE "Incumbent" = 'Joe Waggonner'
wikisql
CREATE TABLE table_name_16 ( airport VARCHAR, icao VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What airport has an ICAO of Birk?
SELECT airport FROM table_name_16 WHERE icao = "birk"
sql_create_context
CREATE TABLE table_name_23 ( class VARCHAR, race VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What class is the dodge dealers grand prix?
SELECT class FROM table_name_23 WHERE race = "the dodge dealers grand prix"
sql_create_context
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 EMAIL, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
nvbench
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_DIRE_CD text, MED_DIRE_NM text,...
SELECT * FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '1303547' AND t_kc21.IN_HOSP_DATE BETWEEN '2003-02-21' AND '2005-09-08' EXCEPT SELECT * FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '1303547' AND t_kc21.IN_HOSP_DATE BETWEEN '2003-02-21' AND '2005-09-08' AND t_kc21.MED_ORG_DEPT_NM = '乳腺外科'
css
CREATE TABLE table_203_344 ( id number, "#" number, "date" text, "opponent" text, "score" text, "win" text, "loss" text, "save" text, "attendance" number, "record" text, "other info" text ) -- Using valid SQLite, answer the following questions for the tables provided above....
SELECT "date" FROM table_203_344 ORDER BY id DESC LIMIT 1
squall
CREATE TABLE table_67552 ( "Season" real, "Series" text, "Races" text, "Wins" text, "Position" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the smallest season with 6 races, 2 wins, and a Series of all-japan gt championship>
SELECT MIN("Season") FROM table_67552 WHERE "Races" = '6' AND "Series" = 'all-japan gt championship' AND "Wins" = '2'
wikisql
CREATE TABLE table_22779004_1 ( regular_season_winner VARCHAR, tournament_winner VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who won the regular season when Maryland won the tournament?
SELECT regular_season_winner FROM table_22779004_1 WHERE tournament_winner = "Maryland"
sql_create_context
CREATE TABLE table_name_52 ( player VARCHAR, pick VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What player was drafted 252?
SELECT player FROM table_name_52 WHERE pick = 252
sql_create_context
CREATE TABLE table_28298589_2 ( site VARCHAR, time VARCHAR, visiting_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many site entries are there at 3:30pm and the visiting team is coastal carolina?
SELECT COUNT(site) FROM table_28298589_2 WHERE time = "3:30pm" AND visiting_team = "Coastal Carolina"
sql_create_context
CREATE TABLE table_name_20 ( total VARCHAR, year_s__won VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the total for the golfer who had a year won of 1987?
SELECT total FROM table_name_20 WHERE year_s__won = "1987"
sql_create_context
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 ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid n...
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 5
mimic_iii
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 Class, COUNT(Class) FROM Ship WHERE NOT Ship_ID IN (SELECT Ship_ID FROM captain) GROUP BY Class ORDER BY COUNT(Class)
nvbench
CREATE TABLE table_60608 ( "Official Name" text, "Status" text, "Area km 2" real, "Population" real, "Census Ranking" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Census Ranking has a Population smaller than 879, and an Area km 2 larger than...
SELECT "Census Ranking" FROM table_60608 WHERE "Population" < '879' AND "Area km 2" > '537.62'
wikisql
CREATE TABLE table_59995 ( "Election" text, "First member" text, "First party" text, "Second member" text, "Second party" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the second member with first member Sir Rowland Hill, BT, and a conservat...
SELECT "Second member" FROM table_59995 WHERE "First member" = 'sir rowland hill, bt' AND "Second party" = 'conservative'
wikisql
CREATE TABLE table_name_18 ( award_ceremony VARCHAR, nominee VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For which Award Ceremony was Emilio Pichardo as Bobby Strong nominated?
SELECT award_ceremony FROM table_name_18 WHERE nominee = "emilio pichardo as bobby strong"
sql_create_context
CREATE TABLE table_name_12 ( week INTEGER, opponent VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average week for the game against baltimore colts with less than 41,062 in attendance?
SELECT AVG(week) FROM table_name_12 WHERE opponent = "baltimore colts" AND attendance < 41 OFFSET 062
sql_create_context
CREATE TABLE table_name_69 ( high_assists VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the High assists for march 25?
SELECT high_assists FROM table_name_69 WHERE date = "march 25"
sql_create_context
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0),...
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(EMPLOYEE_ID) DESC
nvbench
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) ...
SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime, t1.patienthealthsystemstayid FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = ...
eicu
CREATE TABLE table_name_65 ( country VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the country of Craig Stadler?
SELECT country FROM table_name_65 WHERE player = "craig stadler"
sql_create_context
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospita...
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT lab.patientunitstayid FROM lab WHERE lab.labname = 'glucose')) AND STRFTIME('%y', cost.chargetime) = '2105' GROUP BY cos...
eicu