instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_65282 ( "Name" text, "Position" text, "League Apps" text, "League Goals" real, "FA Cup Apps" text, "FA Cup Goals" real, "League Cup Apps" text, "League Cup Goals" real, "FLT Apps" text, "FLT Goals" real, "Total Apps" text, "Total Goals" real ) -- Usin...
SELECT MAX("FA Cup Goals") FROM table_65282 WHERE "FLT Goals" > '0'
wikisql
CREATE TABLE table_name_42 ( start_source VARCHAR, loan_club VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the loan start source when the loan club is fulham?
SELECT start_source FROM table_name_42 WHERE loan_club = "fulham"
sql_create_context
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.short_title = "Form cutan ileoureterost"
mimicsql_data
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-85328...
eicu
CREATE TABLE table_72889 ( "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. -- Name t...
SELECT "High assists" FROM table_72889 WHERE "Score" = 'L 98–103 (OT)'
wikisql
CREATE TABLE table_26376 ( "Province (ashkharh)" text, "Armenian name" text, "Area (km\u00b2)" real, "Number of cantons (gavars)" real, "Center" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the center of the Artsakh province?
SELECT "Center" FROM table_26376 WHERE "Province (ashkharh)" = 'Artsakh'
wikisql
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2089" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
mimicsql_data
CREATE TABLE table_name_79 ( away_team VARCHAR, home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What did the away team score when playing North Melbourne?
SELECT away_team AS score FROM table_name_79 WHERE home_team = "north melbourne"
sql_create_context
CREATE TABLE table_43396 ( "Season" text, "Games" real, "Lost" real, "Points" real, "Pct %" real, "Goals for" real, "Goals against" real, "Playoffs" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest Pct %, when Goals Aga...
SELECT MAX("Pct %") FROM table_43396 WHERE "Goals against" < '229'
wikisql
CREATE TABLE jobs ( job_id text, job_title text, min_salary number, max_salary number ) CREATE TABLE job_history ( employee_id number, start_date time, end_date time, job_id text, department_id number ) CREATE TABLE regions ( region_id number, region_name text ) CREATE TAB...
SELECT first_name, last_name, hire_date, salary, department_id FROM employees WHERE NOT first_name LIKE '%M%'
spider
CREATE TABLE table_58374 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the record of the game that had a home team of Colorado, and a visiting team of Winnipeg?
SELECT "Record" FROM table_58374 WHERE "Home" = 'colorado' AND "Visitor" = 'winnipeg'
wikisql
CREATE TABLE table_name_49 ( result VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result of the game against the Los Angeles Dons?
SELECT result FROM table_name_49 WHERE opponent = "los angeles dons"
sql_create_context
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 hz_info JOIN zyjzjlb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND person_info_hz_info.KH = hz_info.KH AND person_info_hz_info.KLX = hz_info.KLX AND person_info_hz_info.YLJGDM = hz_info.YLJGDM AND person_info_hz_i...
css
CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) 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 Dorm_amenity ( amenid INTEGER, amenit...
SELECT Fname, COUNT(Fname) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' GROUP BY Fname ORDER BY COUNT(Fname) DESC
nvbench
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.discharge_location = "SHORT TERM HOSPITAL"
mimicsql_data
CREATE TABLE table_204_392 ( id number, "#" number, "stadium" text, "capacity" number, "city" text, "country" text, "domed or retractable roof" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many stadiums are above 60,000 people ?
SELECT COUNT("stadium") FROM table_204_392 WHERE "capacity" > 60000
squall
CREATE TABLE table_66939 ( "Year" text, "Start" text, "Qual" text, "Rank" text, "Finish" text, "Laps" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where did the driver who started 9 with a qualifing speed of 152.672 and finished fewer than 197...
SELECT "Finish" FROM table_66939 WHERE "Laps" < '197' AND "Start" = '9' AND "Qual" = '152.672'
wikisql
CREATE TABLE table_204_882 ( id number, "number" number, "builder" text, "entered service" text, "withdrawn" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what year was number 445 and 446 entered into service ?
SELECT "entered service" FROM table_204_882 WHERE "number" = 445
squall
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) 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...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 83182 AND admissions.dischtime IS NULL) AND transfers.careunit = 'csru' ORDER BY transfers.intime DESC LIMIT 1
mimic_iii
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(*) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '008-19005')) AND treatment.treatmentname = 'mri - head' AND DATETIME(treatment.t...
eicu
CREATE TABLE table_31626 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the first leg score in that match where Marseille was the first team?
SELECT "1st leg" FROM table_31626 WHERE "Team 1" = 'marseille'
wikisql
CREATE TABLE rating ( rid number, mid number, stars number, ratingdate time ) CREATE TABLE reviewer ( rid number, name text ) CREATE TABLE movie ( mid number, title text, year number, director text ) -- Using valid SQLite, answer the following questions for the tables provide...
SELECT T2.title, AVG(T1.stars) FROM rating AS T1 JOIN movie AS T2 ON T1.mid = T2.mid GROUP BY T1.mid ORDER BY AVG(T1.stars) DESC LIMIT 1
spider
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 qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_NM = '苗慧捷' AND t_kc22.STA_DATE BETWEEN '2004-08-29' AND '2014-05-22' AND t_kc22.SELF_PAY_PRO < 0.71 UNION SELECT COUNT(*) FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gyb.PERSON_NM = '苗慧捷' AND t_k...
css
CREATE TABLE table_76969 ( "Result" text, "Race" text, "Distance" text, "Weight" real, "Winner or 2nd" text, "Pos'n" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the weight number when the distance was 5 f?
SELECT COUNT("Weight") FROM table_76969 WHERE "Distance" = '5 ½ f'
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 treatment ( treat...
SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-39202') AND NOT patient.admissionheight IS NULL AND DATETIME(patient.unitadmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-...
eicu
CREATE TABLE county_public_safety ( LOCATION VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the location shared by most counties?
SELECT LOCATION FROM county_public_safety GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1
sql_create_context
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 SOC_SRT_DIRE_CD, SOC_SRT_DIRE_NM FROM t_kc22 WHERE MED_CLINIC_ID = '19710178151' AND OVE_SELF_AMO > 1575.84
css
CREATE TABLE table_55055 ( "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. -- What is the home team score that played the away...
SELECT "Home team score" FROM table_55055 WHERE "Away team" = 'north melbourne'
wikisql
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TA...
SELECT COUNT(*), Location FROM Users WHERE NOT Location IS NULL GROUP BY Location ORDER BY COUNT(Location) DESC
sede
CREATE TABLE table_6759 ( "Date" text, "Pos." text, "Player" text, "From club" text, "Transfer fee" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Player had a Date of 31 jan. 2008, and a Transfer fee of 3.87m?
SELECT "Player" FROM table_6759 WHERE "Date" = '31 jan. 2008' AND "Transfer fee" = '£3.87m'
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 jybgb.BGDH FROM jybgb WHERE jybgb.JZLSH = '65133267001' AND NOT jybgb.KSMC LIKE '%影像%'
css
CREATE TABLE customers ( customer_id number, payment_method_code text, customer_code text, customer_name text, customer_address text, customer_phone text, customer_email text ) CREATE TABLE department_stores ( dept_store_id number, dept_store_chain_id number, store_name text, ...
SELECT product_id, product_name FROM products WHERE product_price < 600 OR product_price > 900
spider
CREATE TABLE table_25936 ( "Episode" text, "First broadcast" text, "Seans team" text, "Jasons team" text, "Scores" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the seans team being 13 november 2008
SELECT "Seans team" FROM table_25936 WHERE "First broadcast" = '13 November 2008'
wikisql
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.icd9_code = "591"
mimicsql_data
CREATE TABLE table_27396005_2 ( constructor VARCHAR, grid VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many constructors had a grid of 13?
SELECT COUNT(constructor) FROM table_27396005_2 WHERE grid = 13
sql_create_context
CREATE TABLE table_47059 ( "Place" text, "Player" text, "Country" text, "Score" real, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which united states player finished with a place of t10?
SELECT "Player" FROM table_47059 WHERE "Country" = 'united states' AND "Place" = 't10'
wikisql
CREATE TABLE table_60676 ( "Name" text, "Wikis" text, "Web publishing" text, "Calendaring software" text, "Project Management" text, "Workflow system" text, "Document Management" text, "List Management" text, "XML Forms Management and workflow" text, "Discussion" text, "Blogs...
SELECT "Project Management" FROM table_60676 WHERE "Blogs" = 'no' AND "XML Forms Management and workflow" = 'no' AND "Enterprise search" = 'no' AND "Social software" = 'no'
wikisql
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text,...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT inputevents_cv.itemid FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28443)) AND DATETIME(inputevents_cv....
mimic_iii
CREATE TABLE table_18618 ( "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 was the maxiumum for the first elected?
SELECT MAX("First elected") FROM table_18618
wikisql
CREATE TABLE table_name_3 ( driver VARCHAR, engine VARCHAR, chassis VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the Driver, when the Engine was 7.1 l6, and when the Chassis was Mercedes-Benz SSK l?
SELECT driver FROM table_name_3 WHERE engine = "7.1 l6" AND chassis = "mercedes-benz ssk l"
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 demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "1" AND diagnoses.long_title = "Hypospadias"
mimicsql_data
CREATE TABLE county_public_safety ( County_ID int, Name text, Population int, Police_officers int, Residents_per_officer int, Case_burden int, Crime_rate real, Police_force text, Location text ) CREATE TABLE city ( City_ID int, County_ID int, Name text, White real, ...
SELECT Police_force, COUNT(*) FROM county_public_safety GROUP BY Police_force ORDER BY COUNT(*) DESC
nvbench
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 T1.Code, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter
nvbench
CREATE TABLE table_1028356_3 ( score VARCHAR, partner VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the score with partner Jim Pugh?
SELECT score FROM table_1028356_3 WHERE partner = "Jim Pugh"
sql_create_context
CREATE TABLE table_25017530_6 ( cfl_team VARCHAR, position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the cfl team for lb position
SELECT cfl_team FROM table_25017530_6 WHERE position = "LB"
sql_create_context
CREATE TABLE table_name_20 ( mascot VARCHAR, enrollment__2010_ VARCHAR, school VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the mascot with an enrollment (2010) less than 980, and heritage as the school?
SELECT mascot FROM table_name_20 WHERE enrollment__2010_ < 980 AND school = "heritage"
sql_create_context
CREATE TABLE table_15365 ( "Category" text, "Film" text, "Director(s)" text, "Country" text, "Nominating Festival" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which nominating festival did Russia enter?
SELECT "Nominating Festival" FROM table_15365 WHERE "Country" = 'russia'
wikisql
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '陈敏才' AND t_kc22.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT > 1086.52)
css
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 demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "GUILLAIN BARRE SYNDROME" AND demographic.age < "59"
mimicsql_data
CREATE TABLE table_name_68 ( round INTEGER, college VARCHAR, overall VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the round when the college is north carolina and the overall is more than 124?
SELECT SUM(round) FROM table_name_68 WHERE college = "north carolina" AND overall > 124
sql_create_context
CREATE TABLE table_41904 ( "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. -- What is the Away team when the home team was wycombe wanderers?
SELECT "Away team" FROM table_41904 WHERE "Home team" = 'wycombe wanderers'
wikisql
CREATE TABLE table_72450 ( "Result" text, "Date" text, "Race" text, "Venue" text, "Group" text, "Distance" text, "Weight (kg)" text, "Jockey" text, "Winner/2nd" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What group info is availa...
SELECT "Group" FROM table_72450 WHERE "Weight (kg)" = '56.5'
wikisql
CREATE TABLE table_56533 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which event was in round 1, resulted in a win, and ...
SELECT "Event" FROM table_56533 WHERE "Round" = '1' AND "Res." = 'win' AND "Record" = '15-4'
wikisql
CREATE TABLE table_74930 ( "Year" real, "Class" text, "Team" text, "Points" real, "Wins" real ) -- 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_74930 WHERE "Year" = '1975' AND "Wins" < '0'
wikisql
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE prescriptions ( row_id number, subject_id number,...
SELECT COUNT(*) > 0 FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 7533)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine out foley...
mimic_iii
CREATE TABLE table_5815 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "Location Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What location has an attendance ...
SELECT "Location Attendance" FROM table_5815 WHERE "Score" = 'l 90–91 (ot)'
wikisql
CREATE TABLE hz_info_mzjzjlb ( JZLSH number, YLJGDM number, mzjzjlb_id number ) 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, ...
SELECT COUNT(mzjzjlb.ZZYSGH) FROM hz_info JOIN mzjzjlb JOIN hz_info_mzjzjlb ON hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX 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_...
css
CREATE TABLE table_7392 ( "Player" text, "Club" text, "League" real, "FA Cup" real, "FA Trophy" real, "League Cup" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average total of halifax town club, which has a leagu...
SELECT AVG("Total") FROM table_7392 WHERE "Club" = 'halifax town' AND "League" < '30' AND "FA Cup" > '3'
wikisql
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND lab.fluid = "Blood"
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 treatment ( treat...
SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'coronary artery disease - no previous cabg') AS t1 GROUP BY t1.u...
eicu
CREATE TABLE table_name_27 ( result VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What resulted in a score of 22-21?
SELECT result FROM table_name_27 WHERE score = "22-21"
sql_create_context
CREATE TABLE table_name_49 ( date VARCHAR, runner_s__up VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On which date did Ian Mosey finish runner-up?
SELECT date FROM table_name_49 WHERE runner_s__up = "ian mosey"
sql_create_context
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admi...
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE (COURSE_1.number = 599 OR COURSE_1.number = 101) AND COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.depar...
advising
CREATE TABLE table_name_5 ( lead VARCHAR, event VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the lead for the 2008 WCC?
SELECT lead FROM table_name_5 WHERE event = "2008 wcc"
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.age < "68"
mimicsql_data
CREATE TABLE table_5373 ( "Date" text, "Result" text, "Score" text, "Brazil scorers" text, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Competition's Score was 1-2?
SELECT "Competition" FROM table_5373 WHERE "Score" = '1-2'
wikisql
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) 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...
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 ( t20_matches VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What T20 match was played in 1979?
SELECT t20_matches FROM table_name_33 WHERE year = "1979"
sql_create_context
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 employees ( EMPLOYEE_ID decimal(6,0...
SELECT HIRE_DATE, MANAGER_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY HIRE_DATE
nvbench
CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, ...
SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((flight.airline_code = 'DL') AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND flight.to_airport = AIRPORT...
atis
CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar,...
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SEATTLE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city...
atis
CREATE TABLE table_name_45 ( gold INTEGER, total INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average amount of gold medals for a country with more than 12 total medals?
SELECT AVG(gold) FROM table_name_45 WHERE total > 12
sql_create_context
CREATE TABLE table_1341568_14 ( incumbent VARCHAR, elected VARCHAR, party VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Republican incumbent was elected in 1974?
SELECT incumbent FROM table_1341568_14 WHERE elected = 1974 AND party = "Republican"
sql_create_context
CREATE TABLE table_1805191_50 ( district VARCHAR, party VARCHAR, first_elected VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What district first elected a Democratic incumbent in 1998?
SELECT district FROM table_1805191_50 WHERE party = "Democratic" AND first_elected = 1998
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "50801" AND lab.flag = "abnormal"
mimicsql_data
CREATE TABLE table_31849 ( "Pick #" real, "MLS Team" text, "Player" text, "Position" text, "Affiliation" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What affiliations have Pick #s under 32?
SELECT "Affiliation" FROM table_31849 WHERE "Pick #" < '32'
wikisql
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_20...
SELECT meter_400, ID FROM swimmer ORDER BY meter_400
nvbench
CREATE TABLE table_name_70 ( position VARCHAR, round VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What position did a. j. feeley play who was picked in round 5?
SELECT position FROM table_name_70 WHERE round = 5 AND player = "a. j. feeley"
sql_create_context
CREATE TABLE table_2713 ( "Edition" text, "Round" text, "Date" text, "Partnering" text, "Against" text, "Surface" text, "Opponents" text, "W/L" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the total number of ro...
SELECT COUNT("Round") FROM table_2713 WHERE "Against" = 'The Netherlands'
wikisql
CREATE TABLE Video_games ( gname VARCHAR, gtype VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show all video games with type Collectible card game.
SELECT gname FROM Video_games WHERE gtype = "Collectible card game"
sql_create_context
CREATE TABLE appointment ( appointmentid number, patient number, prepnurse number, physician number, start time, end time, examinationroom text ) CREATE TABLE nurse ( employeeid number, name text, position text, registered boolean, ssn number ) CREATE TABLE procedures (...
SELECT COUNT(*) FROM appointment
spider
CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_...
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, fare, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1....
atis
CREATE TABLE table_name_7 ( winner VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Winner of the Game on November 26?
SELECT winner FROM table_name_7 WHERE date = "november 26"
sql_create_context
CREATE TABLE table_204_15 ( id number, "year" number, "date" text, "venue" text, "city" text, "country" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many times is usa listed as the country ?
SELECT COUNT(*) FROM table_204_15 WHERE "country" = 'usa'
squall
CREATE TABLE mzjybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH number, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, ...
SELECT mzjzjlb.JZLSH FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE hz_info.RYBH = '45714321' AND NOT mzjzjlb.JZLSH IN (SELECT zyjybgb.JZLSH FROM zyjybgb WHERE zyjybgb.BGRQ >= '2014-09-08' UNION SELECT mzjybgb.JZLSH FROM mzjybgb WHERE mzjybgb...
css
CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE time_zone ( time_zone_code tex...
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 = 'WASHINGTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'TOR...
atis
CREATE TABLE table_12649 ( "Perpetrator" text, "Year" text, "Location" text, "Country" text, "Killed" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the location for Yemen in 1994?
SELECT "Location" FROM table_12649 WHERE "Year" = '1994' AND "Country" = 'yemen'
wikisql
CREATE TABLE cite ( cited int, citing int ) CREATE TABLE publication_keyword ( kid int, pid int ) CREATE TABLE journal ( homepage varchar, jid int, name varchar ) CREATE TABLE organization ( continent varchar, homepage varchar, name varchar, oid int ) CREATE TABLE domain_...
SELECT author.name FROM author, journal, publication, writes WHERE journal.name = 'PVLDB' AND publication.jid = journal.jid AND publication.year > 2010 AND writes.aid = author.aid AND writes.pid = publication.pid
academic
CREATE TABLE table_name_62 ( avg_g VARCHAR, att_cmp_int VARCHAR, effic VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Avg/G that has a Att-Cmp-Int of 1 1 0, and an Effic larger than 394 is what total?
SELECT COUNT(avg_g) FROM table_name_62 WHERE att_cmp_int = "1–1–0" AND effic > 394
sql_create_context
CREATE TABLE table_9536 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where was the friendly competition on 17 December 1967 played at?
SELECT "Venue" FROM table_9536 WHERE "Competition" = 'friendly' AND "Date" = '17 december 1967'
wikisql
CREATE TABLE table_name_57 ( seats_in_hamburgische_bürgerschaft VARCHAR, name__english_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT ARE THE SEATS IN Hamburgische B rgerschaft WITH THE NAME alliance '90/the greens?
SELECT seats_in_hamburgische_bürgerschaft FROM table_name_57 WHERE name__english_ = "alliance '90/the greens"
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 d_labitems ( row_id number, itemid number, label text ) CREATE TABLE procedures_icd ( row_id number, subject_id...
SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 31300) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND inputevents_...
mimic_iii
CREATE TABLE table_69497 ( "Game" real, "Date" text, "Score" text, "Location" text, "Time" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Game larger than 4, and a Time of 2:26 resulted in what score?
SELECT "Score" FROM table_69497 WHERE "Game" > '4' AND "Time" = '2:26'
wikisql
CREATE TABLE table_name_98 ( away_team VARCHAR, home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the score of the away team that played Essendon?
SELECT away_team AS score FROM table_name_98 WHERE home_team = "essendon"
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 MIN(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "RASH"
mimicsql_data
CREATE TABLE table_23575917_6 ( scores VARCHAR, lees_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When kevin bridges and katy wix are both on the less team what is the score?
SELECT scores FROM table_23575917_6 WHERE lees_team = "Kevin Bridges and Katy Wix"
sql_create_context
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
SELECT COUNT(*) FROM (SELECT jybgb.KSBM FROM txmzjzjlb JOIN jybgb ON txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE txmzjzjlb.YLJGDM = '6945213' AND jybgb.BGRQ BETWEEN '2005-04-09' AND '2021-12-15' GROUP BY jybgb.KSBM HAVING COUNT(*) >= 3 UNION SELECT jybgb.KSBM FROM ftxmzjzjlb ...
css
CREATE TABLE Student ( Sex VARCHAR, Fname VARCHAR, Lname VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the gender of the student Linda Smith?
SELECT Sex FROM Student WHERE Fname = "Linda" AND Lname = "Smith"
sql_create_context
CREATE TABLE table_name_61 ( country VARCHAR, label VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the country for Sony / Sony Bmg?
SELECT country FROM table_name_61 WHERE label = "sony / sony bmg"
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 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.icd9_code = "9229"
mimicsql_data