instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, v...
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t1.itemid FROM (SELECT labevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 20 AND 29) AND STRFTIME('%y', labevents.c...
mimic_iii
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm...
SELECT admissions.dischtime FROM admissions WHERE admissions.subject_id = 7375 AND STRFTIME('%y', admissions.dischtime) <= '2100' ORDER BY admissions.dischtime LIMIT 1
mimic_iii
CREATE TABLE table_20944 ( "Round" real, "Circuit" text, "Date" text, "Pole Position" text, "Fastest Lap" text, "Winning Driver" text, "Winning Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the winning driver at Okayama Intern...
SELECT "Winning Driver" FROM table_20944 WHERE "Circuit" = 'Okayama International Circuit'
wikisql
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) ...
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 procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age B...
mimic_iii
CREATE TABLE table_name_33 ( away_team VARCHAR, score VARCHAR, home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Away team at the Wolverhampton Wanderers Home game with a Score of 2 0?
SELECT away_team FROM table_name_33 WHERE score = "2–0" AND home_team = "wolverhampton wanderers"
sql_create_context
CREATE TABLE table_22050544_1 ( winner VARCHAR, event__number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the winner in event number 15h?
SELECT winner FROM table_22050544_1 WHERE event__number = "15H"
sql_create_context
CREATE TABLE staff ( staff_id number, staff_first_name text, staff_last_name text, other_staff_details text ) CREATE TABLE problem_status_codes ( problem_status_code text, problem_status_description text ) CREATE TABLE problems ( problem_id number, product_id number, closure_author...
SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Dameon" AND T2.staff_last_name = "Frami" UNION SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Jolie" AND T2.staff_las...
spider
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 ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND procedures.long_title = "(Aorto)coronary bypass of three coronary arteries"
mimicsql_data
CREATE TABLE table_33081 ( "sliding tackle" text, "spear tackle" text, "dump tackle" text, "body tackle" text, "ankle tap" text, "diving tackle" text, "bumping/blocking" text, "shoulder charge" text, "steal/intercept ball" text, "Chicken wing" text ) -- Using valid SQLite, answ...
SELECT "steal/intercept ball" FROM table_33081 WHERE "sliding tackle" = 'no' AND "dump tackle" = 'no'
wikisql
CREATE TABLE wrestler ( wrestler_id number, name text, reign text, days_held text, location text, event text ) CREATE TABLE elimination ( elimination_id text, wrestler_id text, team text, eliminated_by text, elimination_move text, time text ) -- Using valid SQLite, ans...
SELECT T1.time FROM elimination AS T1 JOIN wrestler AS T2 ON T1.wrestler_id = T2.wrestler_id ORDER BY T2.days_held DESC LIMIT 1
spider
CREATE TABLE table_27539272_5 ( points INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the maximum number of points?
SELECT MAX(points) FROM table_27539272_5
sql_create_context
CREATE TABLE table_30265 ( "Pick #" real, "CFL Team" text, "Player" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What position was the player who was drafted by Edmonton?
SELECT "Position" FROM table_30265 WHERE "CFL Team" = 'Edmonton'
wikisql
CREATE TABLE table_57805 ( "Annual ridership (2012)" real, "Rider. per mile" real, "Opened" real, "Stations" real, "Lines" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which station has 3,871 riders per mile, and an annual ridership in 2012 of lar...
SELECT MAX("Stations") FROM table_57805 WHERE "Rider. per mile" = '3,871' AND "Annual ridership (2012)" > '15,399,400'
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 MIN(demographic.age) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.dod_year < "2154.0"
mimicsql_data
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wa...
SELECT microlab.organism FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-23724')) AND microlab.culturesite = 'blood, venipuncture' AND STRFTIM...
eicu
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 procedures.icd9_code, prescriptions.drug_type FROM procedures INNER JOIN prescriptions ON procedures.hadm_id = prescriptions.hadm_id WHERE procedures.subject_id = "18480"
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 COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'change in mental status' AND DATETIME(diagnosis.diagnosistime, 'start of ...
eicu
CREATE TABLE College ( cName varchar(20), state varchar(2), enr numeric(5,0) ) CREATE TABLE Player ( pID numeric(5,0), pName varchar(20), yCard varchar(3), HS numeric(5,0) ) CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3) ) ...
SELECT state, enr FROM College AS T1 JOIN Tryout AS T2 ON T1.cName = T2.cName WHERE T2.decision = 'yes' ORDER BY enr DESC
nvbench
CREATE TABLE table_name_74 ( away_team VARCHAR, home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- I want to see the away team the has a home team of richmond
SELECT away_team FROM table_name_74 WHERE home_team = "richmond"
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 employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL v...
SELECT EMAIL, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SALARY
nvbench
CREATE TABLE table_name_72 ( water_park VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the water park with the rank 20?
SELECT water_park FROM table_name_72 WHERE rank = 20
sql_create_context
CREATE TABLE table_63462 ( "Team" text, "Location" text, "County" text, "Division" text, "Home ground" text, "Coach" text, "Captain" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which team is located in Leicester?
SELECT "Team" FROM table_63462 WHERE "Location" = 'leicester'
wikisql
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 T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.name ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE table_8634 ( "Place" real, "Star" text, "Average" real, "Best score" real, "Worst score" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT IS THE HIGHEST PLACE AND BEST SCORE BIGGER THAN 10?
SELECT MAX("Place") FROM table_8634 WHERE "Best score" > '10'
wikisql
CREATE TABLE table_14219514_2 ( home__2nd_leg_ VARCHAR, home__1st_leg_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When belgrano is the home (1st leg) what is the home (2nd leg)?
SELECT home__2nd_leg_ FROM table_14219514_2 WHERE home__1st_leg_ = "Belgrano"
sql_create_context
CREATE TABLE table_23018775_3 ( lap_two VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many lap two's did marco andretti do?
SELECT COUNT(lap_two) FROM table_23018775_3 WHERE name = "Marco Andretti"
sql_create_context
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREAT...
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '035-4428' AND patient.hospitaladmitsource = 'floor' AND DATETIME(patient.hospitaladmittime) >= DATETIME(CURRENT_TIME(), '-2 year') ORDER BY patient.hospitaladmittime DESC LIMIT 1
eicu
CREATE TABLE table_54992 ( "Year" real, "English title" text, "Korean title" text, "Romanization" text, "Role" text, "Director" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Romanization for my old sweetheart?
SELECT "Romanization" FROM table_54992 WHERE "English title" = 'my old sweetheart'
wikisql
CREATE TABLE table_name_61 ( opponents_in_the_final VARCHAR, surface VARCHAR, tournament VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Opponents In The Final, when Surface is 'Carpet', and when Tournament is 'Milan , Italy'?
SELECT opponents_in_the_final FROM table_name_61 WHERE surface = "carpet" AND tournament = "milan , italy"
sql_create_context
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 t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '戚文栋' AND t_kc22.STA_DATE BETWEEN '2001-11-20' AND '2018-06-28' AND t_kc22.SELF_PAY_AMO > 7007.75
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 COUNT(*) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '4403555' AND t_kc21.IN_HOSP_DATE BETWEEN '2006-06-25' AND '2021-02-22' AND t_kc21.REMOTE_SETTLE_FLG = '异地1' OR t_kc21.REMOTE_SETTLE_FLG = '异地2'
css
CREATE TABLE Movie ( mID int, title text, year int, director text ) CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) CREATE TABLE Reviewer ( rID int, name text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show ...
SELECT mID, AVG(stars) FROM Rating GROUP BY mID
nvbench
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 text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2112" AND lab.itemid = "51026"
mimicsql_data
CREATE TABLE table_19101 ( "Club" text, "Played" text, "Won" 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 follo...
SELECT "Points" FROM table_19101 WHERE "Tries for" = '83'
wikisql
CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER ) CREATE TABLE station ( id INTEG...
SELECT date, COUNT(date) FROM weather WHERE max_temperature_f >= 80
nvbench
CREATE TABLE table_12936521_2 ( current_conference VARCHAR, institution VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What current conference is Post University a member of?
SELECT current_conference FROM table_12936521_2 WHERE institution = "Post University"
sql_create_context
CREATE TABLE Addresses ( address_id INTEGER, line_1 VARCHAR(120), line_2 VARCHAR(120), line_3 VARCHAR(120), city VARCHAR(80), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), other_address_details VARCHAR(255) ) CREATE TABLE Assessment_Notes ( no...
SELECT date_of_notes, COUNT(date_of_notes) FROM Assessment_Notes ORDER BY COUNT(date_of_notes)
nvbench
CREATE TABLE table_name_83 ( points INTEGER, chassis VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of points for the vehicle with a mp4-17d chassis earlier than 2003?
SELECT SUM(points) FROM table_name_83 WHERE chassis = "mp4-17d" AND year < 2003
sql_create_context
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, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZD...
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZ...
css
CREATE TABLE table_name_47 ( date VARCHAR, competition VARCHAR, result VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When is the Competition of friendly match with a Result of 2 1?
SELECT date FROM table_name_47 WHERE competition = "friendly match" AND result = "2–1"
sql_create_context
CREATE TABLE table_name_96 ( points INTEGER, entrant VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was Yardley-BRM's points high after 1971?
SELECT MAX(points) FROM table_name_96 WHERE entrant = "yardley-brm" AND year > 1971
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 prescription...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "BRADYCARDIA"
mimicsql_data
CREATE TABLE table_38127 ( "Pick #" real, "Round" text, "Player" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What position(s) did the player(s) with a pick number of 125 play?
SELECT "Position" FROM table_38127 WHERE "Pick #" = '125'
wikisql
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ...
WITH QuesTagInfo(quesId, quesCreationDate, quesHasTag) AS (SELECT Id AS quesId, DATE(CreationDate) AS quesCreationDate, CASE WHEN (Tags LIKE ('%<##TagName##>%')) THEN 1 ELSE 0 END AS quesHasTag FROM Posts WHERE PostTypeId = 1) SELECT quesCreationDate, COUNT(*) AS "total_questions", SUM(quesHasTag) AS "has_tag" FROM Que...
sede
CREATE TABLE table_1449176_1 ( population VARCHAR, common_of VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How may population figures are given for Settimo Torinese
SELECT COUNT(population) FROM table_1449176_1 WHERE common_of = "Settimo Torinese"
sql_create_context
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 text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.dod_year <= "2180.0"
mimicsql_data
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
SELECT jybgb.BGDH FROM hz_info JOIN mzjzjlb JOIN jybgb 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 WHERE hz_info.RYBH = '20499920' AND jybgb.BGRQ BETWEEN '2010-05-11' AND '2020-04-09' UNION...
css
CREATE TABLE table_20277 ( "Name" text, "Overs Bowled" text, "Maidens" real, "Runs Conceded" real, "Wickets" real, "Extras" real, "E.R." text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the least runs conceded for brett lee
SELECT MIN("Runs Conceded") FROM table_20277 WHERE "Name" = 'Brett Lee'
wikisql
CREATE TABLE table_name_88 ( bronze INTEGER, total VARCHAR, silver VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many bronze medals did the country with 7 medals and over 5 silver medals receive?
SELECT SUM(bronze) FROM table_name_88 WHERE total = 7 AND silver > 5
sql_create_context
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime ...
SELECT AVG(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'helicobacter pylori') AND DATETIME(diagnoses_icd.charttime) >= DATETIME(CURRENT_TIME(), '-4 year') GRO...
mimic_iii
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, ...
SELECT se.OwnerUserId, COUNT(*) FROM SuggestedEdits AS se INNER JOIN Posts AS p ON p.Id = se.PostId WHERE se.OwnerUserId != p.OwnerUserId GROUP BY se.OwnerUserId ORDER BY COUNT(*) DESC
sede
CREATE TABLE table_75192 ( "Surname" text, "First" text, "D.O.B." text, "Uni#" real, "Bats" text, "Throws" text, "Position" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Surname has Throws of l, and a DOB of 5/02/79?
SELECT "Surname" FROM table_75192 WHERE "Throws" = 'l' AND "D.O.B." = '5/02/79'
wikisql
CREATE TABLE table_25418 ( "Year" real, "Majors" real, "ATP wins" real, "Total wins" real, "Earnings ($)" real, "Money list rank" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what year was his money list rank 3?
SELECT MIN("Year") FROM table_25418 WHERE "Money list rank" = '3'
wikisql
CREATE TABLE table_204_297 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which countries earned the same number of silver medals as german...
SELECT COUNT("nation") FROM table_204_297 WHERE "nation" <> 'germany' AND "silver" = (SELECT "silver" FROM table_204_297 WHERE "nation" = 'germany')
squall
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE cost ( costid number, ...
SELECT MAX(vitalperiodic.sao2) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-214052') AND NOT patient.unitdischargetime IS NULL OR...
eicu
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, ...
SELECT t2.drug 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 admissions.subject_id = 61591 AND procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_proce...
mimic_iii
CREATE TABLE table_68988 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year shows 4 points?
SELECT "Year" FROM table_68988 WHERE "Points" = '4'
wikisql
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 qtb.MED_SER_ORG_NO FROM qtb WHERE qtb.PERSON_NM = '柏泰初' AND qtb.IN_HOSP_DATE BETWEEN '2015-08-27' AND '2016-11-04' GROUP BY qtb.MED_SER_ORG_NO ORDER BY COUNT(*) DESC LIMIT 1 UNION SELECT gyb.MED_SER_ORG_NO FROM gyb WHERE gyb.PERSON_NM = '柏泰初' AND gyb.IN_HOSP_DATE BETWEEN '2015-08-27' AND '2016-11-04' GROUP BY gy...
css
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, ...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'midazolam (versed) 2 mg/2ml inj 1 mg' AND STRFTIME(...
eicu
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 zyjybgb.JYLX FROM zyjybgb WHERE zyjybgb.BGDH = '35125613493' UNION SELECT mzjybgb.JYLX FROM mzjybgb WHERE mzjybgb.BGDH = '35125613493'
css
CREATE TABLE table_name_52 ( opponent VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Opponent, when Attendance is 62,170?
SELECT opponent FROM table_name_52 WHERE attendance = "62,170"
sql_create_context
CREATE TABLE table_name_46 ( country VARCHAR, airport VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Paris-Charles de Gaulle airport is in which country?
SELECT country FROM table_name_46 WHERE airport = "paris-charles de gaulle airport"
sql_create_context
CREATE TABLE table_name_15 ( location VARCHAR, fatalities VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What location had 25/25 fatalities?
SELECT location FROM table_name_15 WHERE fatalities = "25/25"
sql_create_context
CREATE TABLE artists ( id INTEGER, name VARCHAR(120) ) CREATE TABLE playlists ( id INTEGER, name VARCHAR(120) ) CREATE TABLE invoice_lines ( id INTEGER, invoice_id INTEGER, track_id INTEGER, unit_price NUMERIC(10,2), quantity INTEGER ) CREATE TABLE playlist_tracks ( playlist_i...
SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state ORDER BY billing_state
nvbench
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )...
SELECT diagnosis.diagnosisname FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-34475')) AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CU...
eicu
CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar...
SELECT DISTINCT name, number FROM course WHERE credits = 7 AND department = 'EECS'
advising
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 lab ( labid numbe...
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '035-20156' AND patient.hospitaladmitsource = 'direct admit' AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY patient.hospitaladmittime LIMIT 1
eicu
CREATE TABLE table_1965650_3 ( pick__number INTEGER, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the least pick # for doug gibson
SELECT MIN(pick__number) FROM table_1965650_3 WHERE player = "Doug Gibson"
sql_create_context
CREATE TABLE table_name_19 ( gold INTEGER, rank VARCHAR, bronze VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest number of gold medals for the team ranked 7 with less than 3 bronze?
SELECT MAX(gold) FROM table_name_19 WHERE rank = "7" AND bronze < 3
sql_create_context
CREATE TABLE table_16206 ( "Name" text, "Dates active" text, "Peak classification" text, "Windspeeds" text, "Pressure" text, "Areas affected" text, "Damage (USD)" text, "Deaths" text, "Refs" text ) -- Using valid SQLite, answer the following questions for the tables provided above....
SELECT "Dates active" FROM table_16206 WHERE "Name" = 'Kamba'
wikisql
CREATE TABLE table_23921 ( "Number" text, "Previous BR No." real, "Taken into deptal stock" real, "Withdrawn" real, "Disposal" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the total number of previous br number for number 21
SELECT COUNT("Previous BR No.") FROM table_23921 WHERE "Number" = '21'
wikisql
CREATE TABLE table_train_99 ( "id" int, "mini_mental_state_examination_mmse" int, "language" string, "renal_disease" bool, "hepatic_disease" bool, "allergy_to_formoterol" bool, "geriatric_depression_scale_gds" int, "NOUSE" float ) -- Using valid SQLite, answer the following questions f...
SELECT * FROM table_train_99 WHERE allergy_to_formoterol = 1
criteria2sql
CREATE TABLE table_name_8 ( gross_revenue__2011_ VARCHAR, state VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the gross revenue in 2011 for MO?
SELECT gross_revenue__2011_ FROM table_name_8 WHERE state = "mo"
sql_create_context
CREATE TABLE table_203_399 ( id number, "pos." text, "driver" text, "co-driver" text, "car" text, "time" text, "difference" text, "points" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- pg andersson and toni gardemeister were both driv...
SELECT "car" FROM table_203_399 WHERE "driver" = 'pg andersson'
squall
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.insurance = "Private" AND demographic.dob_year < "2023"
mimicsql_data
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, ...
SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'obstructive sleep apnea') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 97330 AND admissions.dischtim...
mimic_iii
CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_ID = '37519458' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT > 3819.76)
css
CREATE TABLE table_13836704_4 ( airport VARCHAR, total_passengers_2009 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what's the airport with total passengers 2009 being 157933
SELECT airport FROM table_13836704_4 WHERE total_passengers_2009 = 157933
sql_create_context
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Descr...
SELECT UpVotes AS upvotes, COUNT(*) AS total_users FROM Users WHERE Reputation >= 15 GROUP BY UpVotes ORDER BY UpVotes
sede
CREATE TABLE table_26787 ( "Contestant" text, "Starting Weight (kg)" text, "Final Weight (kg)" text, "Weight Lost (kg)" text, "Percentage Lost" text, "Position (out of Eliminated Contestants)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who i...
SELECT "Contestant" FROM table_26787 WHERE "Position (out of Eliminated Contestants)" = '4th'
wikisql
CREATE TABLE table_name_48 ( opponent VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which team did the Patriots play when there was a game attendance of 73,369?
SELECT opponent FROM table_name_48 WHERE attendance = "73,369"
sql_create_context
CREATE TABLE table_51790 ( "Election" text, "D\u00e1il" text, "Share of votes" text, "Seats" real, "Total seats" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- With a dail of 24th and more than 57 seats, what is the election?
SELECT "Election" FROM table_51790 WHERE "Seats" > '57' AND "D\u00e1il" = '24th'
wikisql
CREATE TABLE table_47553 ( "Region (year)" text, "No. 1" text, "No. 2" text, "No. 3" text, "No. 4" text, "No. 5" text, "No. 6" text, "No. 7" text, "No. 8" text, "No. 9" text, "No. 10" text ) -- Using valid SQLite, answer the following questions for the tables provided above...
SELECT "No. 7" FROM table_47553 WHERE "No. 5" = 'olivia' AND "No. 2" = 'emma'
wikisql
CREATE TABLE table_name_65 ( against INTEGER, points VARCHAR, played VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which average Against has Points of 6, and a Played smaller than 9?
SELECT AVG(against) FROM table_name_65 WHERE points = 6 AND played < 9
sql_create_context
CREATE TABLE table_23822 ( "Barangay" text, "District" text, "Population (May 1, 2000)" real, "Population (August 1, 2007)" real, "Population (May 1, 2010)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the total number of district for populat...
SELECT COUNT("District") FROM table_23822 WHERE "Population (May 1, 2010)" = '478'
wikisql
CREATE TABLE table_28037619_2 ( us_viewers__million_ VARCHAR, directed_by VARCHAR, written_by VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many million u.s. viewers saw the episode that was directed by roger young and written by debra j. fisher?
SELECT us_viewers__million_ FROM table_28037619_2 WHERE directed_by = "Roger Young" AND written_by = "Debra J. Fisher"
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND lab.itemid = "50902"
mimicsql_data
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 text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ABDOMINAL ABSCESS" AND demographic.admityear < "2162"
mimicsql_data
CREATE TABLE table_name_15 ( format VARCHAR, label VARCHAR, catalog VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the format for the album under the label, luaka bop, that had a catalog number of 3645 and dated after 1981?
SELECT format FROM table_name_15 WHERE catalog = "3645" AND date > 1981 AND label = "luaka bop"
sql_create_context
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 person_info.JGDM, person_info.JGMC, COUNT(person_info.RYBH) 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 mzjzjlb.JZZDSM = '慢性龈炎' GROUP BY person_info.JGDM
css
CREATE TABLE table_2709_4 ( format VARCHAR, owner VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the format for the station owned by Dakota Broadcasting?
SELECT format FROM table_2709_4 WHERE owner = "Dakota Broadcasting"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH te...
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb ON mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH AND mzjzjlb_jybgb.YLJGDM = jybgb.YLJGDM AND mzjzjlb_jybgb.BGDH = jybgb....
css
CREATE TABLE table_1425948_1 ( number_in_fleet INTEGER, chassis_model VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Chassis model Scania K360ua has what minimum number in fleet?
SELECT MIN(number_in_fleet) FROM table_1425948_1 WHERE chassis_model = "Scania K360UA"
sql_create_context
CREATE TABLE table_22296 ( "No. in series" 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 original air date of the episode with th...
SELECT "Original air date" FROM table_22296 WHERE "Production code" = '1115'
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 * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN person_info_hz_info ON person_info.RYBH = person_info_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_MZJZ...
css
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 employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), ...
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
nvbench
CREATE TABLE table_name_82 ( venue VARCHAR, goal VARCHAR, result VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which venue had more than 9 goals and a final result of 4-1?
SELECT venue FROM table_name_82 WHERE goal > 9 AND result = "4-1"
sql_create_context
CREATE TABLE table_58699 ( "Game" text, "Date" text, "Home Team" text, "Result" text, "Road Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Date has a Road Team of chicago, and a Result of 88-85 (ot)?
SELECT "Date" FROM table_58699 WHERE "Road Team" = 'chicago' AND "Result" = '88-85 (ot)'
wikisql
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
SELECT t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_CD, MIN(t_kc24.PER_EXP / t_kc24.MED_AMOUT) FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.MED_SER_ORG_NO = '4932501' GROUP BY t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_CD ORDER BY MIN(t_kc24.PER_EXP / t_kc24.MED_AMOUT)
css
CREATE TABLE table_34262 ( "Rank" real, "Player" text, "Country" text, "Earnings ( $ )" real, "Wins" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many wins did players earning less than $10,484,065 have?
SELECT SUM("Wins") FROM table_34262 WHERE "Earnings ( $ )" < '10,484,065'
wikisql