instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_name_17 ( league VARCHAR, play_off VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which League that has no playoffs in the Year of 2008 09?
SELECT league FROM table_name_17 WHERE play_off = "–" AND year = "2008–09"
sql_create_context
CREATE TABLE table_name_75 ( date_of_vacancy VARCHAR, manner_of_departure VARCHAR, date_of_appointment VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the vacancy date for the manager appointed on 2 November 2009 who left due to mutual consent?
SELECT date_of_vacancy FROM table_name_75 WHERE manner_of_departure = "mutual consent" AND date_of_appointment = "2 november 2009"
sql_create_context
CREATE TABLE table_name_69 ( latitude INTEGER, pop__2010_ VARCHAR, water__sqmi_ VARCHAR, longitude VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest latitude when there are more than 0.518 square miles of water, a longitude less than...
SELECT MAX(latitude) FROM table_name_69 WHERE water__sqmi_ > 0.518 AND longitude < -99.830606 AND pop__2010_ = 18
sql_create_context
CREATE TABLE table_name_39 ( word_form VARCHAR, khmer VARCHAR, ungegn VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Word Form, when the Khmer is greater than , and the UNGEGN is (mu y) d b le n?
SELECT word_form FROM table_name_39 WHERE khmer > ១០០០០០ AND ungegn = "(muŏy) dáb leăn"
sql_create_context
CREATE TABLE debate ( Debate_ID int, Date text, Venue text, Num_of_Audience int ) CREATE TABLE people ( People_ID int, District text, Name text, Party text, Age int ) CREATE TABLE debate_people ( Debate_ID int, Affirmative int, Negative int, If_Affirmative_Win bool ...
SELECT Venue, COUNT(Venue) FROM debate GROUP BY Venue ORDER BY Venue DESC
nvbench
CREATE TABLE table_58708 ( "Year" real, "Binibining Pilipinas-Universe" text, "Binibining Pilipinas-International" text, "Miss Maja Pilipinas" text, "Binibining Pilipinas-Tourism" text, "First runner-up" text, "Second runner-up" text ) -- Using valid SQLite, answer the following questions ...
SELECT "Binibining Pilipinas-International" FROM table_58708 WHERE "Year" = '1975'
wikisql
CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE SuggestedEdits ( Id number, PostId n...
SELECT DATEFROMPARTS(Year, Month, 1), 100 * ROUND(Votes * 1.0 / Answers, 2) AS Perf FROM (SELECT *, (SELECT COUNT(*) FROM Posts AS AllPosts WHERE AllPosts.OwnerUserId = '##UserId##' AND AllPosts.CreationDate <= DATEFROMPARTS(Year, Month, 1)) AS Answers FROM (SELECT DATEPART(YYYY, Votes.CreationDate) AS Year, DATEPART(M...
sede
CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDispl...
SELECT SUM(CASE WHEN PostTypeId = 1 THEN 1 ELSE 0 END) AS Questions, SUM(CASE WHEN PostTypeId = 2 THEN 1 ELSE 0 END) AS Answers FROM Posts
sede
CREATE TABLE table_name_40 ( attendance INTEGER, opponents VARCHAR, venue VARCHAR, result VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the largest number in attendance at H venue opposing Liverpool with a result of D?
SELECT MAX(attendance) FROM table_name_40 WHERE venue = "h" AND result = "d" AND opponents = "liverpool"
sql_create_context
CREATE TABLE table_58762 ( "Team Name" text, "Schools" text, "Sports" text, "Host" text, "Nickname(s)" text, "Colors" text, "Enrollment (2013/14)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the colors of the team hosted by Chris...
SELECT "Colors" FROM table_58762 WHERE "Host" = 'christopher'
wikisql
CREATE TABLE table_203_549 ( id number, "player" text, "team" text, "date" text, "opponent" text, "venue" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who was the opponent for the boston red sox on july 27 , 1946 ?
SELECT "opponent" FROM table_203_549 WHERE "team" = 'boston red sox' AND "date" = 'july 27, 1946'
squall
CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_season int, Title text, Directed_by text, Original_air_date text, Production_code text ) CREATE TABLE cinema ( Cinema_ID int, Name text, Openning_year int, Capacity int, Location text ) CREATE TABLE schedule...
SELECT Title, SUM(Price) FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID JOIN cinema AS T3 ON T1.Cinema_ID = T3.Cinema_ID GROUP BY Title
nvbench
CREATE TABLE documents_with_expenses ( document_id number, budget_type_code text, document_details text ) CREATE TABLE documents ( document_id number, document_type_code text, project_id number, document_date time, document_name text, document_description text, other_details tex...
SELECT MAX(account_details) FROM accounts UNION SELECT account_details FROM accounts WHERE account_details LIKE "%5%"
spider
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.Y...
css
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswer...
SELECT 'https://stackoverflow.com/questions/', p.Id, p.* FROM Posts AS p WHERE AcceptedAnswerId IN (SELECT Id FROM Posts AS q WHERE q.OwnerUserId = 8200937 AND Score > 1) AND AnswerCount > 1 ORDER BY p.CreationDate DESC
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 * FROM t_kc21 WHERE PERSON_ID = '96041790' AND MED_SER_ORG_NO = '5656156' AND MED_ORG_DEPT_NM LIKE '%静脉%'
css
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
SELECT t_kc21.MED_ORG_DEPT_CD, t_kc21.MED_ORG_DEPT_NM FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.MED_SER_ORG_NO = '5802131' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2012-07-23' AND '2015-10-30' GROUP BY t_kc21.MED_ORG_DEPT_CD ORDER BY SUM(t_kc24.OVE_PAY) DESC LIMIT 12
css
CREATE TABLE table_1342331_43 ( first_elected INTEGER, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year was the first election when Fritz G. Lanham was elected?
SELECT MAX(first_elected) FROM table_1342331_43 WHERE incumbent = "Fritz G. Lanham"
sql_create_context
CREATE TABLE table_55776 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the Decision at Anaheim's home game?
SELECT "Decision" FROM table_55776 WHERE "Home" = 'anaheim'
wikisql
CREATE TABLE table_37975 ( "Tournament" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2011" text, "2012" text, "2013" text, "Career SR" text, "Career Win-Loss" text ) -- Using vali...
SELECT "2012" FROM table_37975 WHERE "2007" = '1r' AND "2008" = '1r' AND "2013" = '2r'
wikisql
CREATE TABLE table_24222 ( "No." real, "Date" text, "Tournament" text, "Winning score" text, "To par" text, "Margin of victory" text, "Runner(s)-up" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many points under par was the winner of t...
SELECT "To par" FROM table_24222 WHERE "Tournament" = 'Miyagi TV Cup Dunlop Ladies Open'
wikisql
CREATE TABLE table_61527 ( "Quarterback" text, "Games" real, "Teams" text, "Wins" real, "Losses" real, "Percent" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the highest wins when the losses is less than 1, team is rams and the games i...
SELECT MAX("Wins") FROM table_61527 WHERE "Losses" < '1' AND "Teams" = 'rams' AND "Games" > '8'
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "F" AND prescriptions.formulary_drug_cd = "D5LR1000"
mimicsql_data
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'ct scan' AND DATETIME(treatment.treatmenttim...
eicu
CREATE TABLE table_55230 ( "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 was the game held when the away team score...
SELECT "Venue" FROM table_55230 WHERE "Away team score" = '16.11 (107)'
wikisql
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREA...
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-13127') AND NOT patient.unitdischargetime IS NULL ORDER BY patie...
eicu
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 medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '006-122712') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT medication.drugname FROM medic...
eicu
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 COUNT(*) FROM person_info JOIN hz_info JOIN mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE person_info.XM = '彭馨欣' AND mzjzjlb.JZKSRQ BETWEEN '2007-04-24' AND '2014-10-25' AND mzjzjlb.YLJGDM = '4381298'
css
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND procedures.icd9_code = "9925"
mimicsql_data
CREATE TABLE mzb ( 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 COUNT(*) FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_ID = '94188667' AND t_kc22.STA_DATE BETWEEN '2004-06-14' AND '2019-06-29' AND t_kc22.SOC_SRT_DIRE_NM = '谷维素片' UNION SELECT COUNT(*) FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gyb.PERSON_ID = '94...
css
CREATE TABLE table_28705 ( "Rank" real, "Athlete" text, "Country" text, "Distance (metres)" text, "Points" text, "Adjusted Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the athlete(s) who scored 691 adjusted points?
SELECT "Athlete" FROM table_28705 WHERE "Adjusted Points" = '691'
wikisql
CREATE TABLE table_66074 ( "Period" text, "Internet Explorer" text, "Firefox" text, "Chrome" text, "Safari" text, "Opera" text, "Other Mozilla" text, "Mobile" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What percentage of users were u...
SELECT "Safari" FROM table_66074 WHERE "Firefox" = '30.82%'
wikisql
CREATE TABLE table_6408 ( "Feature" text, "GT Force" text, "Driving Force EX" text, "Driving Force Pro" text, "Driving Force GT" text, "G25 Racing Wheel" text, "G27 Racing Wheel" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- GT Force of no,...
SELECT "Driving Force GT" FROM table_6408 WHERE "GT Force" = 'no' AND "Driving Force Pro" = 'no' AND "G27 Racing Wheel" = 'no'
wikisql
CREATE TABLE table_name_33 ( points INTEGER, year VARCHAR, wins VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of all points in 1975 with 0 wins?
SELECT SUM(points) FROM table_name_33 WHERE year = 1975 AND wins < 0
sql_create_context
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT MAX(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.ethnicity = "ASIAN"
mimicsql_data
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 allergy ( allergy...
SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '015-100195' AND patient.hospitaladmitsource = 'emergency department' AND STRFTIME('%y', patient.unitadmittime) = '2105'
eicu
CREATE TABLE table_57652 ( "CERCLIS ID" text, "Name" text, "County" text, "Proposed" text, "Listed" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What county has a CERCLIS ID of scd037405362?
SELECT "County" FROM table_57652 WHERE "CERCLIS ID" = 'scd037405362'
wikisql
CREATE TABLE table_name_92 ( date VARCHAR, runner_up VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Date when Runner-up is Sof a Mul novich ( per )?
SELECT date FROM table_name_92 WHERE runner_up = "sofía mulánovich ( per )"
sql_create_context
CREATE TABLE table_66117 ( "School" text, "Location" text, "Mascot" text, "# / County" text, "Enrollment" real, "IHSAA Class / Football/Soccer" text, "Year Joined" real, "Previous Conference" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -...
SELECT "Previous Conference" FROM table_66117 WHERE "IHSAA Class / Football/Soccer" = '4a/5a/2a' AND "Year Joined" > '1926'
wikisql
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID...
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
nvbench
CREATE TABLE table_name_10 ( rank INTEGER, country VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of the ranks for bulgaria?
SELECT SUM(rank) FROM table_name_10 WHERE country = "bulgaria"
sql_create_context
CREATE TABLE table_47892 ( "Year" real, "Album" text, "Release type" text, "Label" text, "Hungarian top 40 album charts" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What type of release was Napisten Hava?
SELECT "Release type" FROM table_47892 WHERE "Album" = 'napisten hava'
wikisql
CREATE TABLE table_15781170_3 ( _number VARCHAR, poll_winner VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many times did drinking games win the poll?
SELECT COUNT(_number) FROM table_15781170_3 WHERE poll_winner = "Drinking Games"
sql_create_context
CREATE TABLE table_name_57 ( studio_host VARCHAR, channel VARCHAR, play_by_play VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the studio host for the game broadcasted by Fox Sports Net west and has Chick Hearn as the play by play commentator ?
SELECT studio_host FROM table_name_57 WHERE channel = "fox sports net west" AND play_by_play = "chick hearn"
sql_create_context
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, uniquepid text,...
SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '018-14586')) AND DATETIME(allergy.allergytime, 'start of year') = DATETIME(C...
eicu
CREATE TABLE table_name_30 ( score VARCHAR, home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Score has a Home team of windsor & eton?
SELECT score FROM table_name_30 WHERE home_team = "windsor & eton"
sql_create_context
CREATE TABLE table_26757_4 ( proto_slavic VARCHAR, serbo_croatian VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When ( ) / gn(ij)ezdo is the serbo-croatian how many proto-slavics are there?
SELECT COUNT(proto_slavic) FROM table_26757_4 WHERE serbo_croatian = "гн(иј)ездо / gn(ij)ezdo"
sql_create_context
CREATE TABLE table_11677691_6 ( hometown VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where is scott starr from?
SELECT hometown FROM table_11677691_6 WHERE player = "Scott Starr"
sql_create_context
CREATE TABLE table_2134521_1 ( pop__1996_ VARCHAR, area__km²_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many people lived in the census division with an area of 15767.99 km2 in 1996?
SELECT pop__1996_ FROM table_2134521_1 WHERE area__km²_ = "15767.99"
sql_create_context
CREATE TABLE table_name_76 ( attendance VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the attendance on May 13?
SELECT attendance FROM table_name_76 WHERE date = "may 13"
sql_create_context
CREATE TABLE table_name_72 ( quay_cranes INTEGER, terminal VARCHAR, berths VARCHAR, operator VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the lowest Quay cranes for Berths of 1 and operator of mtl with terminal of terminal 5 (ct5)
SELECT MIN(quay_cranes) FROM table_name_72 WHERE berths = 1 AND operator = "mtl" AND terminal = "terminal 5 (ct5)"
sql_create_context
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid num...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'insulin regular, human' AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-4 year'))
eicu
CREATE TABLE table_name_15 ( lane INTEGER, react VARCHAR, time VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which lane did the swimmer who had a Reaction time of 0.185 and a time of 20.9 swim in?
SELECT SUM(lane) FROM table_name_15 WHERE react = 0.185 AND time < 20.9
sql_create_context
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 MAX(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '008-32147')) AND lab.labname = 'wbc x 1000' AND STRFTIME('%y-%m', lab.labresulttim...
eicu
CREATE TABLE bdmzjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH number, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZD...
SELECT wdmzjzjlb.CYKSDM, wdmzjzjlb.CYKSMC FROM wdmzjzjlb WHERE wdmzjzjlb.JZLSH = '19545678298' UNION SELECT bdmzjzjlb.CYKSDM, bdmzjzjlb.CYKSMC FROM bdmzjzjlb WHERE bdmzjzjlb.JZLSH = '19545678298'
css
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "V4983" AND prescriptions.drug_type = "MAIN"
mimicsql_data
CREATE TABLE table_53746 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the attendance on October 6?
SELECT "Attendance" FROM table_53746 WHERE "Date" = 'october 6'
wikisql
CREATE TABLE table_5589 ( "Round" real, "Pick #" text, "Player" text, "Position" text, "Nationality" text, "College/junior/club team (league)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What nationality is Larry McMorran?
SELECT "Nationality" FROM table_5589 WHERE "Player" = 'larry mcmorran'
wikisql
CREATE TABLE table_name_12 ( winning_driver VARCHAR, pole_position VARCHAR, fastest_lap VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When the fastest lap was carlos pace and jackie stewart was the pole position, who was the winning driver?
SELECT winning_driver FROM table_name_12 WHERE pole_position = "jackie stewart" AND fastest_lap = "carlos pace"
sql_create_context
CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varchar(20), tot_cred numeric(3,0) ) CREATE TABLE classroom ( building varchar(15), room_number varchar(7), capacity numeric(4,0) ) CREATE TABLE instructor ( ID varchar(5), name varchar(20), dept_name varchar(20)...
SELECT year, COUNT(*) FROM section GROUP BY year
nvbench
CREATE TABLE table_80072 ( "Outcome" text, "Year" real, "Tournament" text, "Partner" text, "Opponent" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which opponent played in the Chinese Taipei Open in 2000?
SELECT "Opponent" FROM table_80072 WHERE "Tournament" = 'chinese taipei open' AND "Year" = '2000'
wikisql
CREATE TABLE table_70769 ( "Week 2" text, "Week 4" text, "Week 6" text, "Week 11" text, "Week 12" text, "Week 13" text, "Week 15" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the week 12 for the week 4 of Gerard Ewelina?
SELECT "Week 12" FROM table_70769 WHERE "Week 4" = 'gerard ewelina'
wikisql
CREATE TABLE table_19664 ( "Year" real, "Mens singles" text, "Womens singles" text, "Mens doubles" text, "Womens doubles" text, "Mixed doubles" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the mens singles for jeliazko valkov dobrinka pen...
SELECT "Mens singles" FROM table_19664 WHERE "Mixed doubles" = 'Jeliazko Valkov Dobrinka Peneva'
wikisql
CREATE TABLE table_416 ( "Jurisdiction" text, "Voted Yes" real, "Percent Yes" text, "Voted No" real, "Percent No" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what's the jurisdiction where voted no is 322971
SELECT "Jurisdiction" FROM table_416 WHERE "Voted No" = '322971'
wikisql
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartr...
SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(...
eicu
CREATE TABLE table_name_19 ( venue VARCHAR, state VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Venue is in Colorado?
SELECT venue FROM table_name_19 WHERE state = "colorado"
sql_create_context
CREATE TABLE zyb ( 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.IN_DIAG_DIS_CD, qtb.IN_DIAG_DIS_NM FROM qtb WHERE qtb.PERSON_ID = '18467147' AND qtb.IN_HOSP_DATE BETWEEN '2005-03-16' AND '2014-05-31' GROUP BY qtb.IN_DIAG_DIS_CD ORDER BY COUNT(*) DESC LIMIT 1 UNION SELECT gyb.IN_DIAG_DIS_CD, gyb.IN_DIAG_DIS_NM FROM gyb WHERE gyb.PERSON_ID = '18467147' AND gyb.IN_HOSP_DATE...
css
CREATE TABLE table_name_68 ( Id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the 2013 value with a qf in 2011?
SELECT 2013 FROM table_name_68 WHERE 2011 = "qf"
sql_create_context
CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) CREATE TABLE CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), ...
SELECT STU_LNAME, COUNT(STU_LNAME) FROM STUDENT AS T1 JOIN ENROLL AS T2 ON T1.STU_NUM = T2.STU_NUM WHERE T2.ENROLL_GRADE = 'C' OR T2.ENROLL_GRADE = 'A' GROUP BY STU_LNAME
nvbench
CREATE TABLE table_22665117_1 ( district_name VARCHAR, dist_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- If the district ID is 74907, what is the name of the district?
SELECT district_name FROM table_22665117_1 WHERE dist_id = 74907
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 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.long_title = "Hyposmolality and/or hyponatremia"
mimicsql_data
CREATE TABLE table_23960 ( "Round" real, "Choice" real, "Player" text, "Position" text, "Height" text, "Weight" real, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the weight of Eben Britton?
SELECT MAX("Weight") FROM table_23960 WHERE "Player" = 'Eben Britton'
wikisql
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) -- Using valid SQLite, answer the following questions for the...
SELECT T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter
nvbench
CREATE TABLE table_name_55 ( venue VARCHAR, against VARCHAR, opposing_teams VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the venue with more than 3 against, and South Africa is the opposing team?
SELECT venue FROM table_name_55 WHERE against > 3 AND opposing_teams = "south africa"
sql_create_context
CREATE TABLE table_15181 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the smallest rank with a Total smaller than 1?
SELECT MIN("Rank") FROM table_15181 WHERE "Total" < '1'
wikisql
CREATE TABLE table_71131 ( "Season" text, "Club" text, "Country" text, "Competition" text, "Apps." real, "Goals" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many goals did he score with under 26 appearances for werder bremen?
SELECT COUNT("Goals") FROM table_71131 WHERE "Apps." < '26' AND "Club" = 'werder bremen'
wikisql
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb....
css
CREATE TABLE pitching ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, w INTEGER, l INTEGER, g INTEGER, gs INTEGER, cg INTEGER, sho INTEGER, sv INTEGER, ipouts NUMERIC, h INTEGER, er INTEGER, hr INTEGER, bb INTEGER, so I...
SELECT yearid, COUNT(*) FROM hall_of_fame GROUP BY yearid ORDER BY yearid
nvbench
CREATE TABLE Has_Allergy ( StuID INTEGER, Allergy VARCHAR(20) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), ...
SELECT LName, Age FROM Student WHERE StuID IN (SELECT StuID FROM Has_Allergy WHERE Allergy = "Milk" INTERSECT SELECT StuID FROM Has_Allergy WHERE Allergy = "Cat") ORDER BY LName
nvbench
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
SELECT All_Home, COUNT(All_Home) FROM basketball_match GROUP BY All_Home
nvbench
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 captain GROUP BY Class ORDER BY Class DESC
nvbench
CREATE TABLE table_77648 ( "Team" text, "Home city" text, "Stadium" text, "Capacity" real, "2011\u201312 season" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What team had a capacity of over 26,542, a home city of milan, and finished the 2011-2012...
SELECT "Team" FROM table_77648 WHERE "Capacity" > '26,542' AND "Home city" = 'milan' AND "2011\u201312 season" = '6th in serie a'
wikisql
CREATE TABLE table_33828 ( "Season" text, "Episodes" real, "First airdate" text, "Last airdate" text, "Nielsen ranking" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which season last aired on May 6, 1987?
SELECT "Season" FROM table_33828 WHERE "Last airdate" = 'may 6, 1987'
wikisql
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE ReviewTaskStates ( Id number, Name te...
SELECT DATEFROMPARTS(YEAR(CreationDate), MONTH(CreationDate), 1) AS YearMonth, (CAST(SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) AS FLOAT) / NULLIF(CAST(SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) AS FLOAT), 0)) AS Ratio FROM Votes WHERE CreationDate > '01-01-2015' AND CreationDate < '12-31-2020' GROUP BY DATEF...
sede
CREATE TABLE table_name_44 ( athlete VARCHAR, country VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which athlete is from Norway?
SELECT athlete FROM table_name_44 WHERE country = "norway"
sql_create_context
CREATE TABLE table_53849 ( "Species" text, "Strain" text, "Type" text, "Base Pairs" real, "Genes" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What base pair has 832 genes?
SELECT "Base Pairs" FROM table_53849 WHERE "Genes" = '832'
wikisql
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, va...
SELECT admissions.marital_status FROM admissions WHERE admissions.subject_id = 19144 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1
mimic_iii
CREATE TABLE table_7881 ( "Name" text, "Location" text, "Years as tallest" text, "Height metres / ft" text, "Floors" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many floors did the tallest building in Aston have?
SELECT "Floors" FROM table_7881 WHERE "Location" = 'aston'
wikisql
CREATE TABLE table_2498 ( "Season" real, "Series" text, "Team" text, "Races" real, "Wins" real, "Poles" real, "F/Laps" real, "Podiums" real, "Points" real, "Position" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many poles ...
SELECT "Poles" FROM table_2498 WHERE "Series" = 'Italian Formula Renault 2.0 Winter Series'
wikisql
CREATE TABLE table_15383430_1 ( result VARCHAR, original_artist VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many songs were sung by queen?
SELECT COUNT(result) FROM table_15383430_1 WHERE original_artist = "Queen"
sql_create_context
CREATE TABLE Participates_in ( stuid INTEGER, actid INTEGER ) CREATE TABLE Faculty_Participates_in ( FacID INTEGER, actid INTEGER ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, c...
SELECT Rank, COUNT(Rank) FROM Faculty GROUP BY Rank ORDER BY COUNT(Rank)
nvbench
CREATE TABLE Apartment_Buildings ( building_full_name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the building full names that contain the word 'court'?
SELECT building_full_name FROM Apartment_Buildings WHERE building_full_name LIKE "%court%"
sql_create_context
CREATE TABLE table_45622 ( "Round" text, "Pick" real, "Player" text, "Position" text, "Shoots" text, "Nationality" text, "League" text, "Birthplace, Date" text, "Height, Weight" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is ...
SELECT "Pick" FROM table_45622 WHERE "Nationality" = 'canada' AND "Player" = 'ian schultz'
wikisql
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 prescriptions ( subject_id text, hadm_id...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "DMI keto nt st uncntrld" AND lab.flag = "delta"
mimicsql_data
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 diagnoses ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2173" AND lab.label = "Alanine Aminotransferase (ALT)"
mimicsql_data
CREATE TABLE table_30698 ( "Constellation" text, "IAU abbreviation" text, "Other abbreviation" text, "Genitive" text, "Family" text, "Origin" text, "Meaning" text, "Brightest star" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is t...
SELECT "Family" FROM table_30698 WHERE "Genitive" = 'Lyncis /ˈlɪnsɨs/'
wikisql
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC...
SELECT COUNT(*) FROM (SELECT jybgb.KSBM FROM mzjzjlb JOIN jybgb JOIN hz_info_mzjzjlb ON hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_inf...
css
CREATE TABLE table_1342331_43 ( party VARCHAR, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What party is incumbent Oliver H. Cross?
SELECT party FROM table_1342331_43 WHERE incumbent = "Oliver H. Cross"
sql_create_context
CREATE TABLE table_72809 ( "Name" text, "Latitude" text, "Longitude" text, "Diameter (km)" text, "Year named" real, "Name origin" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- At a latitude of 71.1e, what is the feature's name origin?
SELECT "Name origin" FROM table_72809 WHERE "Longitude" = '71.1E'
wikisql
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 countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), ...
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)
nvbench