instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY SUM(MANAGER_ID)
nvbench
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 decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), ...
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(DEPARTMENT_ID)
nvbench
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following questions for the...
SELECT Name, Price FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Price
nvbench
CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) CREATE TABLE ENROLL (...
SELECT CRS_CODE, COUNT(*) FROM CLASS GROUP BY CRS_CODE ORDER BY CRS_CODE
nvbench
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE fare_basis ( fare_basis_code ...
SELECT DISTINCT flight.flight_id FROM airport, flight WHERE airport.airport_code = 'DAL' AND flight.from_airport = airport.airport_code
atis
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 SUM(t_kc22.AMOUNT) FROM t_kc22 JOIN mzb ON mzb.MED_ORG_DEPT_CD = t_kc22.MED_CLINIC_ID WHERE mzb.PERSON_SEX = '郎颖初' AND t_kc22.STA_DATE BETWEEN '2003-12-09' AND '2012-01-10' AND t_kc22.MED_INV_ITEM_TYPE = '西药费'
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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.religion = "CATHOLIC" AND procedures.long_title = "Aortography"
mimicsql_data
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT gwyjzb.IN_DIAG_DIS_CD, gwyjzb.IN_DIAG_DIS_NM FROM gwyjzb WHERE gwyjzb.PERSON_ID = '37329044' AND gwyjzb.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 6376.37) UNION SELECT fgwyjzb.IN_DIAG_DIS_CD, fgwyjzb.IN_DIAG_DIS_NM FROM fgwyjzb WHERE fgwyjzb.PERSON_ID = '37329044' AND fg...
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 (SELECT COUNT(*) FROM t_kc21 WHERE MED_SER_ORG_NO = '9920378' AND IN_HOSP_DATE BETWEEN '2014-07-27' AND '2020-02-28') - (SELECT COUNT(*) FROM t_kc21 WHERE MED_SER_ORG_NO = '9920378' AND IN_HOSP_DATE BETWEEN '2014-07-27' AND '2020-02-28' AND IN_DIAG_DIS_CD = OUT_DIAG_DIS_CD)
css
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 t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) AND STRFTIME('%y', treatment.treatmenttime) = '2101' GROUP BY treatment.t...
eicu
CREATE TABLE table_22262 ( "Foodstuff" text, "Pinoresinol" real, "Syringaresinol" real, "Sesamin" text, "Lariciresinol" real, "Secoisolariciresinol" real, "Matairesinol" real, "Hydroxymatairesinol" real ) -- Using valid SQLite, answer the following questions for the tables provided abo...
SELECT "Sesamin" FROM table_22262 WHERE "Secoisolariciresinol" = '240'
wikisql
CREATE TABLE table_2801442_1 ( density_in_2011___km²_ VARCHAR, population__2011_census_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the density in the district with 2320529 citizens in 2011?
SELECT density_in_2011___km²_ FROM table_2801442_1 WHERE population__2011_census_ = 2320529
sql_create_context
CREATE TABLE table_38685 ( "Type" text, "Actual Exponent" text, "Exp (biased)" text, "Exponent field" text, "Significand (fraction field)" text, "Value" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What value has negative infinity?
SELECT "Value" FROM table_38685 WHERE "Type" = 'negative infinity'
wikisql
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
SELECT mzjzjlb.YLJGDM 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.person_info_XM = '葛心怡' UNION SELECT zyjzjlb.YLJGDM FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb...
css
CREATE TABLE table_name_31 ( date VARCHAR, away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was the away team burnley?
SELECT date FROM table_name_31 WHERE away_team = "burnley"
sql_create_context
CREATE TABLE mzjzjlb_jybgb ( YLJGDM_MZJZJLB text, BGDH number, YLJGDM 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, X...
SELECT jybgb.BGDH FROM jybgb WHERE jybgb.JZLSH = '67797677349' AND jybgb.KSMC LIKE '%感染%'
css
CREATE TABLE table_name_19 ( winning_driver VARCHAR, circuit VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the winning driver in taunus
SELECT winning_driver FROM table_name_19 WHERE circuit = "taunus"
sql_create_context
CREATE TABLE table_name_92 ( opponent VARCHAR, result VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the opponent at the game with a result of W 38-14?
SELECT opponent FROM table_name_92 WHERE result = "w 38-14"
sql_create_context
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE gsi ( c...
SELECT COUNT(*) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'MODGREEK' AND course.number = 318 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016
advising
CREATE TABLE table_56486 ( "Grid" real, "Constructor" text, "Qual" real, "Rank" real, "Laps" real, "Time/Retired" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What laps have a rank larger than 13 and the Time/Retired is accident, and a Qual sm...
SELECT "Laps" FROM table_56486 WHERE "Rank" > '13' AND "Time/Retired" = 'accident' AND "Qual" < '136.98'
wikisql
CREATE TABLE web_client_accelerator ( id VARCHAR, name VARCHAR ) CREATE TABLE accelerator_compatible_browser ( accelerator_id VARCHAR, browser_id VARCHAR ) CREATE TABLE browser ( name VARCHAR, id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. ...
SELECT T3.name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T1.name = 'CACHEbox' INTERSECT SELECT T3.name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id...
sql_create_context
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE diagnoses_icd ( ...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT outputevents.itemid 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 = 95280) AND NOT icustays.outtime IS NULL OR...
mimic_iii
CREATE TABLE table_14710984_2 ( young_rider_classification VARCHAR, mountains_classification VARCHAR, stage VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who won the young rider classification in Stage 9 where the mountain classification was Emanuele Se...
SELECT young_rider_classification FROM table_14710984_2 WHERE mountains_classification = "Emanuele Sella" AND stage = 9
sql_create_context
CREATE TABLE table_name_27 ( streak VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Streak has a Score of 98 109?
SELECT streak FROM table_name_27 WHERE score = "98–109"
sql_create_context
CREATE TABLE table_11301 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where the grid is under 19, the time finished was logged as received outside assistance, what's the...
SELECT COUNT("Laps") FROM table_11301 WHERE "Time/Retired" = 'received outside assistance' AND "Grid" < '19'
wikisql
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 vitalperiodic ( vitalperiodicid number, ...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'diagnosis' AND cost.eventid IN (SELECT diagnosis.diagnosisid FROM diagnosis WHERE diagnosis.diagnosisname = 'drug overdose- general - multiple agents ingested')
eicu
CREATE TABLE table_2923917_4 ( sydney VARCHAR, distance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many dollars is listed under Sydney when the distance is 10km?
SELECT sydney FROM table_2923917_4 WHERE distance = "10km"
sql_create_context
CREATE TABLE people ( Birth_Place VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the most common birth place of people?
SELECT Birth_Place FROM people GROUP BY Birth_Place ORDER BY COUNT(*) DESC LIMIT 1
sql_create_context
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses_icd ( row...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_i...
mimic_iii
CREATE TABLE table_20435 ( "Result" text, "Date" text, "Race" text, "Venue" text, "Group" text, "Distance" text, "Weight (kg)" text, "Time" text, "Jockey" text, "Winner/2nd" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which gr...
SELECT "Group" FROM table_20435 WHERE "Time" = '1:11.65'
wikisql
CREATE TABLE table_29972 ( "No." real, "Player" text, "Club" text, "Test career" text, "Tests" real, "Catches" real, "Stumpings" real, "Total dismissals" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What club did Cyril Christiani play ...
SELECT "Club" FROM table_29972 WHERE "Player" = 'Cyril Christiani'
wikisql
CREATE TABLE table_64477 ( "Date" real, "Doubles, I Class" real, "Doubles, II Class" real, "Greater Doubles" real, "Doubles" real, "Semidoubles" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Greater Doubles have Doubles,...
SELECT AVG("Greater Doubles") FROM table_64477 WHERE "Doubles, II Class" < '17'
wikisql
CREATE TABLE wdmzjzjlb ( 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, MZZYZDZ...
SELECT jybgb.BGDH FROM hz_info JOIN wdmzjzjlb JOIN jybgb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '40049431' AND NOT jybgb.BGDH IN (SELECT jyjgzbb.BGDH FRO...
css
CREATE TABLE table_name_79 ( game INTEGER, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest game with a 3-2 record?
SELECT MAX(game) FROM table_name_79 WHERE record = "3-2"
sql_create_context
CREATE TABLE table_test_15 ( "id" int, "anemia" bool, "cell_therapy" bool, "hiv_infection" bool, "hemoglobin_a1c_hba1c" float, "body_weight" float, "renal_disease" bool, "creatinine_clearance_cl" float, "active_hepatitis" bool, "chronic_inflammatory_disease" bool, "platelet_c...
SELECT * FROM table_test_15 WHERE platelet_count < 100000
criteria2sql
CREATE TABLE table_name_55 ( res VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result for the match against Wataru Sakata?
SELECT res FROM table_name_55 WHERE opponent = "wataru sakata"
sql_create_context
CREATE TABLE table_15736385_1 ( date VARCHAR, location VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On what date was the race at Nazareth?
SELECT date FROM table_15736385_1 WHERE location = "Nazareth"
sql_create_context
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid numb...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '005-87465' AND patient.unitdischargetime IS NULL
eicu
CREATE TABLE table_name_99 ( floors__stories_ INTEGER, height_ft__m_ VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many floors are in the 274 (84) ft (m) building that is ranked number 1?
SELECT AVG(floors__stories_) FROM table_name_99 WHERE height_ft__m_ = "274 (84)" AND rank > 1
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE txmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, K...
SELECT * FROM person_info JOIN hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jy...
css
CREATE TABLE table_20193855_2 ( book_title VARCHAR, publisher VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the title of the book when the publisher is black car publishing?
SELECT book_title FROM table_20193855_2 WHERE publisher = "Black Car Publishing"
sql_create_context
CREATE TABLE table_14708760_3 ( round_1 INTEGER, round_2 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest score of round 1 where they also shot 90 in round 2
SELECT MAX(round_1) FROM table_14708760_3 WHERE round_2 = 90
sql_create_context
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE ReviewTasks ( Id num...
SELECT Comments.Score, Comments.Id AS "comment_link", Comments.CreationDate FROM Comments WHERE UserId = @UserId ORDER BY Comments.Score DESC
sede
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 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 = jy...
css
CREATE TABLE table_train_243 ( "id" int, "c_peptide_level" float, "finger_stick_measurements" bool, "diabetic" string, "fasting_blood_glucose_fbg" float, "hypoglycemia" bool, "insulin_requirement" float, "triglyceride_tg" float, "a1c" float, "age" float, "NOUSE" float ) -- ...
SELECT * FROM table_train_243 WHERE age > 70
criteria2sql
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime...
SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'pneumonia - community-acquired' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2103') AS t1) - (SEL...
eicu
CREATE TABLE table_203_534 ( id number, "week" number, "date" text, "opponent" text, "home/away" text, "result" text, "bye" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many games did the philadelphia soul lose before earning their fir...
SELECT COUNT(*) FROM table_203_534 WHERE id < (SELECT id FROM table_203_534 WHERE "result" = 'w')
squall
CREATE TABLE table_69460 ( "Rider" text, "Year" real, "Final Position - Giro" real, "Final Position - Tour" real, "Final Position - Vuelta" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of final position-tours Mariano Piccoli, wh...
SELECT COUNT("Final Position - Tour") FROM table_69460 WHERE "Final Position - Giro" > '20' AND "Rider" = 'mariano piccoli' AND "Year" < '1999'
wikisql
CREATE TABLE table_name_64 ( engine VARCHAR, chassis VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What model engine has a lotus 16 chassis?
SELECT engine FROM table_name_64 WHERE chassis = "lotus 16"
sql_create_context
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE microbiologyevents ( row_i...
SELECT transfers.wardid FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 86929 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND NOT transfers.wardid IS NULL ORDER BY transfers.intime DESC LIMIT 1
mimic_iii
CREATE TABLE table_23224961_2 ( unterfranken_west VARCHAR, oberfranken_ost VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When wacker marktredwitz is the oberfranken ost how many unterfranken wests are there?
SELECT COUNT(unterfranken_west) FROM table_23224961_2 WHERE oberfranken_ost = "Wacker Marktredwitz"
sql_create_context
CREATE TABLE table_35579 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On what date was the record 39 54?
SELECT "Date" FROM table_35579 WHERE "Record" = '39–54'
wikisql
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_ORG_DEPT_CD, t_kc21.OUT_DIAG_DIS_NM, AVG(t_kc21.PERSON_AGE) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '5280788' GROUP BY t_kc21.MED_ORG_DEPT_CD, t_kc21.OUT_DIAG_DIS_NM
css
CREATE TABLE region ( Region_id int, Region_code text, Region_name text ) CREATE TABLE storm ( Storm_ID int, Name text, Dates_active text, Max_speed int, Damage_millions_USD real, Number_Deaths int ) CREATE TABLE affected_region ( Region_id int, Storm_ID int, Number_cit...
SELECT Name, Number_Deaths FROM storm WHERE Number_Deaths >= 1 ORDER BY Name
nvbench
CREATE TABLE table_name_72 ( round VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many rounds did the match last when his record was 6-6?
SELECT round FROM table_name_72 WHERE record = "6-6"
sql_create_context
CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) CREATE TABLE Movie ( mID int, title text, year int, director text ) CREATE TABLE Reviewer ( rID int, name text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For d...
SELECT year, COUNT(year) FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title <> T2.title GROUP BY title
nvbench
CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15), Document_Type_Name VARCHAR(255), Document_Type_Description VARCHAR(255) ) CREATE TABLE Ref_Budget_Codes ( Budget_Type_Code CHAR(15), Budget_Type_Description VARCHAR(255) ) CREATE TABLE Projects ( Project_ID INTEGER, Project_Det...
SELECT T1.Project_Details, T1.Project_ID FROM Projects AS T1 JOIN Documents AS T2 ON T1.Project_ID = T2.Project_ID ORDER BY T1.Project_ID
nvbench
CREATE TABLE table_21883 ( "Season" text, "Date" text, "Driver" text, "Team" text, "Chassis" text, "Engine" text, "Laps" text, "Miles (km)" text, "Race Time" text, "Average Speed (mph)" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tabl...
SELECT "Chassis" FROM table_21883 WHERE "Average Speed (mph)" = '169.182'
wikisql
CREATE TABLE table_155 ( "Team" text, "Stadium" text, "Capacity" real, "Lowest" real, "Highest" real, "Average" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many stadiums are there with a capacity of 7500?
SELECT COUNT("Stadium") FROM table_155 WHERE "Capacity" = '7500'
wikisql
CREATE TABLE table_name_88 ( nation VARCHAR, world_rank VARCHAR, birth_date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the nation when the world rank is 6 and the birth date is 1971-07-31?
SELECT nation FROM table_name_88 WHERE world_rank = "6" AND birth_date = "1971-07-31"
sql_create_context
CREATE TABLE table_72703 ( "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 wickets for overs bowled being 15
SELECT "Wickets" FROM table_72703 WHERE "Overs Bowled" = '15'
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 SUM(t_kc22.AMOUNT) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_ID = '61225965' AND t_kc22.t_kc21_CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2007-04-13' AND '2011-03-11' AND t_kc22.MED_INV_ITEM_TYPE = '检查费'
css
CREATE TABLE table_12054 ( "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 did the team score when playing south melbo...
SELECT "Home team score" FROM table_12054 WHERE "Away team" = 'south melbourne'
wikisql
CREATE TABLE table_58402 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the date that has a friendly competition at rheinpark stadion, vaduz
SELECT "Date" FROM table_58402 WHERE "Competition" = 'friendly' AND "Venue" = 'rheinpark stadion, vaduz'
wikisql
CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE field ( fieldid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABL...
SELECT DISTINCT COUNT(DISTINCT writes.paperid) FROM author, writes WHERE author.authorname = 'Mirella Lapata' AND writes.authorid = author.authorid
scholar
CREATE TABLE table_67823 ( "Year" text, "Start" text, "Qual" text, "Rank" text, "Finish" text, "Laps" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the laps for qual of 144.665
SELECT SUM("Laps") FROM table_67823 WHERE "Qual" = '144.665'
wikisql
CREATE TABLE table_40135 ( "Office" text, "Republican ticket" text, "Democratic ticket" text, "Socialist Labor ticket" text, "Prohibition ticket" text, "Independent Citizens' ticket" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What kind of In...
SELECT "Independent Citizens' ticket" FROM table_40135 WHERE "Republican ticket" = 'william j. morgan'
wikisql
CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_...
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.has_exams = 'N' AND course.has_projects = 'Y' AND program_course.category LIKE 'ULCS'
advising
CREATE TABLE time_slot ( time_slot_id varchar(4), day varchar(1), start_hr numeric(2), start_min numeric(2), end_hr numeric(2), end_min numeric(2) ) CREATE TABLE takes ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), grade...
SELECT dept_name, AVG(salary) FROM instructor GROUP BY dept_name ORDER BY AVG(salary) DESC
nvbench
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_kc22 WHERE t_kc22.t_kc21_MED_SER_ORG_NO = '5124932' AND t_kc22.SOC_SRT_DIRE_CD = '4987-7'
css
CREATE TABLE table_60968 ( "Title" text, "Developer" text, "Category" text, "Release date" text, "Version" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Developer has a Release date of 2010-12-16, and a Title of facebook?
SELECT "Developer" FROM table_60968 WHERE "Release date" = '2010-12-16' AND "Title" = 'facebook'
wikisql
CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, ...
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id WHERE program_cour...
advising
CREATE TABLE table_77753 ( "Player" text, "Rec." real, "Yards" real, "Avg." real, "TD's" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average number of TDs when the yards are less than 119, the AVG is larger than 5, and Jamarr Ward is ...
SELECT AVG("TD's") FROM table_77753 WHERE "Yards" < '119' AND "Player" = 'jamarr ward' AND "Avg." > '5'
wikisql
CREATE TABLE table_204_845 ( id number, "round" number, "circuit" text, "location" text, "date" text, "pole position" text, "fastest lap" text, "winning driver" text, "headline event" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- wh...
SELECT "circuit" FROM table_204_845 WHERE "date" > (SELECT "date" FROM table_204_845 WHERE "circuit" = 'albert whitted airport') ORDER BY "date" LIMIT 1
squall
CREATE TABLE table_73249 ( "Conference" text, "Regular Season Winner" text, "Conference Player of the Year" text, "Conference Tournament" text, "Tournament Venue (City)" text, "Tournament Winner" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Wh...
SELECT "Conference Player of the Year" FROM table_73249 WHERE "Tournament Winner" = 'Lafayette'
wikisql
CREATE TABLE table_50193 ( "Player" text, "Country" text, "Year(s) won" real, "Total" real, "To par" real, "Finish" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Highest Total, when Year(s) Won is before 1959?
SELECT MAX("Total") FROM table_50193 WHERE "Year(s) won" < '1959'
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "RUQ PAIN" AND procedures.icd9_code = "8852"
mimicsql_data
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.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name DESC
nvbench
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 ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, ...
SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t4.charttime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.subject_id, t2.charttime FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd...
mimic_iii
CREATE TABLE table_24848 ( "Year" real, "Date" text, "Driver" text, "Team" text, "Manufacturer" text, "Laps" text, "Miles (km)" text, "Race Time" text, "Average Speed (mph)" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided abov...
SELECT "Report" FROM table_24848 WHERE "Team" = 'Roush Fenway Racing'
wikisql
CREATE TABLE table_75547 ( "Week" real, "Date" text, "Opponent" text, "Location" text, "Time ( ET )" text, "Result" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average Week for the game at three rivers stadium, ...
SELECT AVG("Week") FROM table_75547 WHERE "Location" = 'three rivers stadium' AND "Record" = '3–2'
wikisql
CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE voting_record ( stuid number, registration_date text, election_cycle text, president_vote number, vice_president_vote number...
SELECT MAX(age) FROM student
spider
CREATE TABLE table_name_98 ( origin_of_programming VARCHAR, network VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Origin of Programming for the Network NDTV India?
SELECT origin_of_programming FROM table_name_98 WHERE network = "ndtv india"
sql_create_context
CREATE TABLE table_21791 ( "Rank" real, "Country" text, "Miss United Continent" real, "Virreina" real, "1st RU" real, "2nd RU" real, "3rd RU" real, "4th RU" real, "Semifinalists" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided ...
SELECT COUNT("3rd RU") FROM table_21791 WHERE "Country" = 'Canada'
wikisql
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 DISTINCT t1.c1 FROM (SELECT lab.labresult, PERCENT_RANK() OVER (ORDER BY lab.labresult) AS c1 FROM lab WHERE lab.labname = 'calcium' AND lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age = (SELECT patient.age FROM patient WHERE patient.uniquepid = '022-78464' AND NOT patie...
eicu
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
SELECT ACC_Road, SUM(Team_ID) FROM basketball_match GROUP BY ACC_Road
nvbench
CREATE TABLE table_39288 ( "Date" text, "Jurisdiction" text, "Ronald Reagan" text, "George H. W. Bush" text, "John B. Anderson" text, "Howard Baker" text, "John Connally" text, "Phil Crane" text, "Bob Dole" text ) -- Using valid SQLite, answer the following questions for the tables...
SELECT "Date" FROM table_39288 WHERE "Jurisdiction" = 'oregon'
wikisql
CREATE TABLE table_name_3 ( state VARCHAR, electorate VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What state shows for Cunningham?
SELECT state FROM table_name_3 WHERE electorate = "cunningham"
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 mzjzjlb JOIN jybgb ON mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE mzjzjlb.YLJGDM = '8988339' AND jybgb.BGRQ BETWEEN '2000-05-16' AND '2011-08-06' GROUP BY jybgb.KSBM HAVING COUNT(*) <= 1) AS T
css
CREATE TABLE table_name_83 ( heat_points INTEGER, date VARCHAR, result VARCHAR, game VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average Heat Points, when Result is 'Loss', when Game is greater than 72, and when Date is 'April 21'?
SELECT AVG(heat_points) FROM table_name_83 WHERE result = "loss" AND game > 72 AND date = "april 21"
sql_create_context
CREATE TABLE table_name_81 ( location VARCHAR, tournament VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the location of the b.c. open?
SELECT location FROM table_name_81 WHERE tournament = "b.c. open"
sql_create_context
CREATE TABLE fgwyjzb ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT gwyjzb.OUT_DIAG_DIS_NM, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '3002384' GROUP BY gwyjzb.OUT_DIAG_DIS_NM UNION SELECT fgwyjzb.OUT_DIAG_DIS_NM, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '3002384' GROUP BY fgwyjzb.OUT_DIAG_DIS_NM
css
CREATE TABLE table_971 ( "Quarter" text, "Android" text, "iOS" text, "Symbian" text, "BlackBerry OS" text, "Linux" text, "Windows Phone" text, "Other" text, "Total" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- During the quarter of...
SELECT COUNT("BlackBerry OS") FROM table_971 WHERE "Other" = '0.1' AND "Quarter" = '2012 Q2'
wikisql
CREATE TABLE table_28621502_1 ( asia VARCHAR, title VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many of Asian release statuses does Uno HD have?
SELECT COUNT(asia) FROM table_28621502_1 WHERE title = "UNO HD"
sql_create_context
CREATE TABLE table_70092 ( "Project" text, "Year" text, "Location" text, "Capacity" real, "Suites" text, "Architect" text, "Cost" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest capacity in Aslantepe in 2002-2005?
SELECT MAX("Capacity") FROM table_70092 WHERE "Location" = 'aslantepe' AND "Year" = '2002-2005'
wikisql
CREATE TABLE table_name_95 ( tier VARCHAR, runner_up VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Tier when the runner-up is chanda rubin caroline vis?
SELECT tier FROM table_name_95 WHERE runner_up = "chanda rubin caroline vis"
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 t_kc21.IN_DIAG_DIS_CD, t_kc21.IN_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_NM = '钱曼珠' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 143.68)
css
CREATE TABLE table_name_40 ( airport VARCHAR, icao VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the airport with an ICAO of ULLI?
SELECT airport FROM table_name_40 WHERE icao = "ulli"
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Enterococcus group d"
mimicsql_data
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, a...
SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'phosphate') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25050) AND STRFTIME('%y-%m', labevents.charttime) >= '2105-05'
mimic_iii