instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE bdmzjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH number, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZD...
SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_info.RYBH = '...
css
CREATE TABLE table_name_50 ( name VARCHAR, direction VARCHAR, terminus VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which bi-directional route has a terminus at Ecat/Rosa Park Transit Center?
SELECT name FROM table_name_50 WHERE direction = "bi-directional" AND terminus = "ecat/rosa park transit center"
sql_create_context
CREATE TABLE table_9858 ( "Rank" real, "Venue name" text, "Highest attendance" text, "Location" text, "Current seating capacity" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Highest Attendance, when Rank is 90, and when Venue Name is Infin...
SELECT "Highest attendance" FROM table_9858 WHERE "Rank" = '90' AND "Venue name" = 'infineon raceway'
wikisql
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0),...
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID
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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "LEVO500PM"
mimicsql_data
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE presc...
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'granular casts')) AND DATETIME(cost.chargetime) <= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY cost....
mimic_iii
CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE field ( fieldid int ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TAB...
SELECT DISTINCT paper.year FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'deep learning' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid GROUP BY paper.year ORDER BY paper.year
scholar
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_ti...
SELECT DISTINCT student.firstname, student.lastname FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN gsi ON gsi.course_offering_id = course_offering.offering_id INNER JOIN student ON student.student_id = gsi.student_id INNER JOIN semester ON semester.semester_id = course...
advising
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 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.admityear < "2176" AND diagnoses.short_title = "Hypopotassemia"
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 microlab ( microl...
SELECT STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', patient.hospitaladmittime) FROM patient WHERE patient.uniquepid = '035-22706' AND NOT patient.hospitaladmittime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1
eicu
CREATE TABLE table_1342315_12 ( first_elected INTEGER, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was incumbent Leo E. Allen first elected?
SELECT MIN(first_elected) FROM table_1342315_12 WHERE incumbent = "Leo E. Allen"
sql_create_context
CREATE TABLE table_27700530_11 ( high_assists VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who had highest assists at the game against Houston?
SELECT high_assists FROM table_27700530_11 WHERE team = "Houston"
sql_create_context
CREATE TABLE table_name_59 ( overall VARCHAR, position VARCHAR, pick VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total overall number of the ot position player with a pick greater than 5?
SELECT COUNT(overall) FROM table_name_59 WHERE position = "ot" AND pick > 5
sql_create_context
CREATE TABLE table_74978 ( "Round" real, "Pick #" real, "Overall" real, "Name" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what Round was George Thomas Picked?
SELECT AVG("Round") FROM table_74978 WHERE "Name" = 'george thomas'
wikisql
CREATE TABLE gyb ( CLINIC_ID text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, IN...
SELECT 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 '2008-04-28' AND '2018-10-12' AND t_kc22.MED_INV_ITEM_TYPE = '手术费'
css
CREATE TABLE table_name_78 ( total INTEGER, country VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest Total for Australia?
SELECT MAX(total) FROM table_name_78 WHERE country = "australia"
sql_create_context
CREATE TABLE table_77473 ( "Year" real, "Championship" text, "Partner" text, "Opponents in the final" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which opponents in the u.s. championships played after 1945 and had a score of 3 6, 6 ...
SELECT "Opponents in the final" FROM table_77473 WHERE "Championship" = 'u.s. championships' AND "Year" > '1945' AND "Score" = '3–6, 6–4, 2–6, 6–3, 20–18'
wikisql
CREATE TABLE table_train_2 ( "id" int, "gender" string, "pregnancy_or_lactation" bool, "diabetic" string, "electro_systolic_process" bool, "degenerative_pathology" bool, "neurological_disease" bool, "cardiomyopathy" bool, "NOUSE" float ) -- Using valid SQLite, answer the following ...
SELECT * FROM table_train_2 WHERE pregnancy_or_lactation = 1 AND gender = 'female'
criteria2sql
CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) 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...
SELECT t_kc21.OUT_DIAG_DIS_CD, t_kc21.OUT_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_NM = '邹清舒' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 1552.66)
css
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE vitalperiodic ( ...
SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-49538')) AND intakeoutput.cellpath LIKE '%output%' ORDER...
eicu
CREATE TABLE table_178408_1 ( location_of_the_church VARCHAR, sub_parish__sokn_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the location of the church for bremanger
SELECT location_of_the_church FROM table_178408_1 WHERE sub_parish__sokn_ = "Bremanger"
sql_create_context
CREATE TABLE table_name_3 ( place VARCHAR, to_par VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What place has E as the to par, with Mark Wiebe as the player?
SELECT place FROM table_name_3 WHERE to_par = "e" AND player = "mark wiebe"
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab."CATEGORY" = "Blood Gas"
mimicsql_data
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswer...
SELECT p.Id AS "post_link", p.Id AS "post_id", pt.Name AS "post_type", vt.Name AS "vote_type", v.UserId AS "user_link", v.CreationDate AS "vote_date", p.Body FROM Votes AS v JOIN Posts AS p ON v.PostId = p.Id JOIN PostTypes AS pt ON p.PostTypeId = pt.Id JOIN VoteTypes AS vt ON v.VoteTypeId = vt.Id WHERE pt.Name NOT IN ...
sede
CREATE TABLE table_name_31 ( year VARCHAR, winner__female_ VARCHAR, talent__male_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year had Kim Gevaert as the female winner and Xavier de Baerdemaeker as the male talent?
SELECT year FROM table_name_31 WHERE winner__female_ = "kim gevaert" AND talent__male_ = "xavier de baerdemaeker"
sql_create_context
CREATE TABLE table_22476 ( "Township" text, "County" text, "Pop. (2010)" real, "Land ( sqmi )" text, "Water (sqmi)" text, "Latitude" text, "Longitude" text, "GEO ID" real, "ANSI code" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Wh...
SELECT "County" FROM table_22476 WHERE "ANSI code" = '1759686'
wikisql
CREATE TABLE table_71889 ( "Year" real, "Winners" text, "Club" text, "Time" text, "Runners-up" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who won when np cooper av cooke was runner up?
SELECT "Winners" FROM table_71889 WHERE "Runners-up" = 'np cooper av cooke'
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 demographic.age, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Estrella Carroll"
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 Name, MIN(Price) FROM Products GROUP BY Name
nvbench
CREATE TABLE table_39988 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Round" text, "Time" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the resolution for the match that ended by Submission (armba...
SELECT "Res." FROM table_39988 WHERE "Method" = 'submission (armbar)'
wikisql
CREATE TABLE table_21386 ( "Series #" real, "Season #" real, "Title" text, "Directed by" text, "Original air date" text, "Prod. code" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many episodes have the season number of 1?
SELECT COUNT("Series #") FROM table_21386 WHERE "Season #" = '1'
wikisql
CREATE TABLE Staff ( staff_id INTEGER, staff_address_id INTEGER, nickname VARCHAR(80), first_name VARCHAR(80), middle_name VARCHAR(80), last_name VARCHAR(80), date_of_birth DATETIME, date_joined_staff DATETIME, date_left_staff DATETIME ) CREATE TABLE Customer_Payments ( customer...
SELECT date_of_birth, COUNT(date_of_birth) FROM Customers WHERE customer_status_code = 'Good Customer' ORDER BY date_of_birth DESC
nvbench
CREATE TABLE table_name_5 ( location___state VARCHAR, circuit VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the location/state that has adelaide international raceway as the circuit?
SELECT location___state FROM table_name_5 WHERE circuit = "adelaide international raceway"
sql_create_context
CREATE TABLE table_2880 ( "Rank" real, "Rider" text, "Mon 24 Aug" text, "Tues 25 Aug" text, "Wed 26 Aug" text, "Thurs 27 Aug" text, "Fri 28 Aug" text, "Sat 29 Aug" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When roy richardson 476cc ...
SELECT "Sat 29 Aug" FROM table_2880 WHERE "Rider" = 'Roy Richardson 476cc Aermacchi'
wikisql
CREATE TABLE table_61289 ( "Name of ground" text, "Location" text, "Year" text, "FC matches" text, "LA matches" text, "T20 matches" text, "Total" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year was the total 9?
SELECT "Year" FROM table_61289 WHERE "Total" = '9'
wikisql
CREATE TABLE church ( open_date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show the opening year in whcih at least two churches opened.
SELECT open_date FROM church GROUP BY open_date HAVING COUNT(*) >= 2
sql_create_context
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE prescriptions ( row_id num...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT icustays.hadm_id FROM icustays WHERE icustays.icustay_id IN (SELECT inputevents_cv.icustay_id FROM inputevents_cv WHERE inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sc 24 fe ng' AND d_...
mimic_iii
CREATE TABLE table_train_109 ( "id" int, "serum_potassium" float, "systolic_blood_pressure_sbp" int, "body_mass_index_bmi" float, "hypertension" bool, "NOUSE" float ) -- Using valid SQLite, answer the following questions for the tables provided above. -- treated hypertension ( systolic blood ...
SELECT * FROM table_train_109 WHERE hypertension = 1 OR (systolic_blood_pressure_sbp >= 110 AND systolic_blood_pressure_sbp <= 170)
criteria2sql
CREATE TABLE employee ( emp_num number, emp_lname text, emp_fname text, emp_initial text, emp_jobcode text, emp_hiredate time, emp_dob time ) CREATE TABLE department ( dept_code text, dept_name text, school_code text, emp_num number, dept_address text, dept_extension...
SELECT T3.stu_fname FROM class AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211' AND T2.enroll_grade = 'C'
spider
CREATE TABLE table_name_37 ( country VARCHAR, player VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What country did Bart Bryant with a score of 69-70=139 belong to?
SELECT country FROM table_name_37 WHERE score = 69 - 70 = 139 AND player = "bart bryant"
sql_create_context
CREATE TABLE region ( region_id number, region_code text, region_name text ) CREATE TABLE affected_region ( region_id number, storm_id number, number_city_affected number ) CREATE TABLE storm ( storm_id number, name text, dates_active text, max_speed number, damage_millions...
SELECT SUM(number_deaths), SUM(damage_millions_usd) FROM storm WHERE max_speed > (SELECT AVG(max_speed) FROM storm)
spider
CREATE TABLE table_12146637_1 ( episode_title VARCHAR, us_viewers__millions_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many episodes had 9.90 million viewers?
SELECT COUNT(episode_title) FROM table_12146637_1 WHERE us_viewers__millions_ = "9.90"
sql_create_context
CREATE TABLE table_22844 ( "Year" real, "Iowa" text, "Kansas" text, "Minnesota" text, "Missouri" text, "Nebraska" text, "North/South Dakota" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the missouri for 2002
SELECT "Missouri" FROM table_22844 WHERE "Year" = '2002'
wikisql
CREATE TABLE table_name_58 ( chinese_name VARCHAR, english_name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Chinese name for the English name Andy Lau?
SELECT chinese_name FROM table_name_58 WHERE english_name = "andy lau"
sql_create_context
CREATE TABLE table_28634206_1 ( country VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many times was taiwan 3rd runner-up?
SELECT MAX(3 AS rd_runner_up) FROM table_28634206_1 WHERE country = "Taiwan"
sql_create_context
CREATE TABLE table_11023 ( "Country" text, "Alternate title/Translation" text, "TV network(s)" text, "Series premiere" text, "Weekly schedule" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the alternate title/translation of the series that ...
SELECT "Alternate title/Translation" FROM table_11023 WHERE "Series premiere" = 'december 12, 2006'
wikisql
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospit...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'treatment' AND cost.eventid IN (SELECT treatment.treatmentid FROM treatment WHERE treatment.treatmentname = 'antibacterials - cephalosporin')
eicu
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
SELECT Users.Id, Users.EmailHash, Users.WebsiteUrl FROM Users WHERE Users.CreationDate >= '##year:int##' AND Users.Location LIKE '%##location##%'
sede
CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRA...
atis
CREATE TABLE table_name_52 ( gold INTEGER, bronze VARCHAR, total VARCHAR, silver VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the gold when silver is 1, rank is larger than 3, total is smaller than 2, bronze is smaller tha...
SELECT SUM(gold) FROM table_name_52 WHERE silver = 1 AND rank > 3 AND total < 2 AND bronze < 0
sql_create_context
CREATE TABLE table_13178 ( "7:00 am" text, "7:30 am" text, "8:00 am" text, "9:00 am" text, "10:00 am" text, "11:00 am" text, "noon" text, "12:30 pm" text, "1:00 pm" text, "1:30 pm" text, "2:00 pm" text, "3:00 pm" text, "4:30 pm" text, "5:00 pm" text, "6:30 pm"...
SELECT "7:00 am" FROM table_13178 WHERE "3:00 pm" = 'the big cartoonie show'
wikisql
CREATE TABLE table_71868 ( "Team" text, "1st Match" text, "Matches" text, "Lost" text, "% Won" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the matches for gold coast
SELECT "Matches" FROM table_71868 WHERE "Team" = 'gold coast'
wikisql
CREATE TABLE table_2233 ( "Pos" text, "No" text, "Driver" text, "Constructor" text, "Part 1" text, "Part 2" text, "Part 3" text, "Grid" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the driver when the time in part 3 was 1:31.38...
SELECT "Driver" FROM table_2233 WHERE "Part 1" = '1:31.386'
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT diagnoses.icd9_code FROM diagnoses WHERE diagnoses.subject_id = "19420"
mimicsql_data
CREATE TABLE table_name_26 ( tie_no VARCHAR, date VARCHAR, away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the tie number in the game on 5 January 1986 where Exeter City is the away team?
SELECT tie_no FROM table_name_26 WHERE date = "5 january 1986" AND away_team = "exeter city"
sql_create_context
CREATE TABLE table_11501 ( "party" text, "Manhattan" text, "The Bronx" text, "Brooklyn" text, "Queens" text, "Richmond [Staten Is.]" text, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many voters were in Manhattan when 181,639 ...
SELECT "Richmond [Staten Is.]" FROM table_11501 WHERE "The Bronx" = '181,639'
wikisql
CREATE TABLE table_10595 ( "Location" text, "Venue" text, "Promotion" text, "Event" text, "Inductee(s)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the promotion when the event was Acid-fest?
SELECT "Promotion" FROM table_10595 WHERE "Event" = 'acid-fest'
wikisql
CREATE TABLE table_48846 ( "Result" text, "Opponent" text, "Method" text, "Date" text, "Round" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Round has a Method of ko, and a Date of 1958?
SELECT MIN("Round") FROM table_48846 WHERE "Method" = 'ko' AND "Date" = '1958'
wikisql
CREATE TABLE table_12206918_2 ( opponent VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many opponents fought on 1982-12-03?
SELECT COUNT(opponent) FROM table_12206918_2 WHERE date = "1982-12-03"
sql_create_context
CREATE TABLE table_15984 ( "Week" real, "Dance/song" text, "Horwood" text, "Goodman" text, "Dixon" text, "Tonioli" text, "Total" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many songs received a 10 from Goodman and ...
SELECT COUNT("Tonioli") FROM table_15984 WHERE "Goodman" = '10'
wikisql
CREATE TABLE plays_games ( stuid number, gameid number, hours_played number ) CREATE TABLE video_games ( gameid number, gname text, gtype text ) CREATE TABLE sportsinfo ( stuid number, sportname text, hoursperweek number, gamesplayed number, onscholarship text ) CREATE TAB...
SELECT COUNT(DISTINCT stuid) FROM plays_games
spider
CREATE TABLE table_name_83 ( played INTEGER, drawn VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which average Played has a Drawn smaller than 1, and Points larger than 4?
SELECT AVG(played) FROM table_name_83 WHERE drawn < 1 AND points > 4
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) CREATE TABLE zyjzjlb ( YLJGDM text, JZLSH text, MZJZLSH text, KH text, KLX number, HZXM text, WDBZ number, RYDJSJ time, RYTJDM number, RYTJMC text, JZKSDM text, JZKSMC text, RZBQDM t...
SELECT JCZBJGDX, JCZBJGDL, JCZBJGDW FROM jyjgzbb WHERE JYZBLSH = '03911398238'
css
CREATE TABLE table_46201 ( "Lane" real, "Name" text, "Country" text, "Mark" text, "React" real, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What mark has over 813 points in the United States, and a 0.152 react?
SELECT "Mark" FROM table_46201 WHERE "Points" > '813' AND "Country" = 'united states' AND "React" > '0.152'
wikisql
CREATE TABLE table_name_11 ( grid VARCHAR, laps VARCHAR, driver VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many grids have less than 41 laps and a Driver of pedro de la rosa?
SELECT COUNT(grid) FROM table_name_11 WHERE laps < 41 AND driver = "pedro de la rosa"
sql_create_context
CREATE TABLE table_7670 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What kind of Silver has a Nation of norway and a Gold smaller than 3?
SELECT SUM("Silver") FROM table_7670 WHERE "Nation" = 'norway' AND "Gold" < '3'
wikisql
CREATE TABLE table_name_36 ( name VARCHAR, launch VARCHAR, hanzi VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which company launched in 1996 and has a Hanzi of ?
SELECT name FROM table_name_36 WHERE launch = "1996" AND hanzi = "凤凰卫视中文台"
sql_create_context
CREATE TABLE table_10749367_3 ( test_taker VARCHAR, _number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who took test #4?
SELECT test_taker FROM table_10749367_3 WHERE _number = 4
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, ...
SELECT SHRGH, SHRXM FROM jybgb WHERE JZLSH = '41810948156'
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 MIN(t_kc24.MED_AMOUT), MAX(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.t_kc21_MED_SER_ORG_NO = '6281887' AND t_kc24.t_kc21_IN_DIAG_DIS_CD = 'J30.696')
css
CREATE TABLE table_14278 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the opponent of the game with a game number larger than 5 on June 22?
SELECT "Opponent" FROM table_14278 WHERE "Game" > '5' AND "Date" = 'june 22'
wikisql
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TAB...
SELECT Body FROM Posts WHERE LOWER(Body) LIKE '%blcr%'
sede
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate...
SELECT COUNT(A.Id) AS Answers FROM Posts AS A INNER JOIN Users AS U ON A.OwnerUserId = U.Id WHERE NOT A.ParentId IS NULL AND U.Id = '##UserId##'
sede
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2041" AND prescriptions.route = "SC"
mimicsql_data
CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PostHistoryTypes ( Id number, ...
SELECT q.Id AS "post_link", COUNT(a.Id) AS Answers FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id WHERE NOT EXISTS(SELECT Id FROM Posts AS a WHERE a.ParentId = q.Id AND a.Score > 0) GROUP BY q.Id ORDER BY COUNT(a.Id) DESC, q.Id
sede
CREATE TABLE Roles ( Role_Code CHAR(15), Role_Name VARCHAR(255), Role_Description VARCHAR(255) ) CREATE TABLE Ref_Locations ( Location_Code CHAR(15), Location_Name VARCHAR(255), Location_Description VARCHAR(255) ) CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER, Destructio...
SELECT Date_Stored, COUNT(Date_Stored) FROM All_Documents AS T1 JOIN Ref_Calendar AS T2 ON T1.Date_Stored = T2.Calendar_Date ORDER BY COUNT(Date_Stored)
nvbench
CREATE TABLE table_name_79 ( name VARCHAR, nationality VARCHAR, rank VARCHAR, heat VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is from the united states, has a rank less than 9, and heat more than 5?
SELECT name FROM table_name_79 WHERE rank < 9 AND heat > 5 AND nationality = "united states"
sql_create_context
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE a...
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-203413')) AND intakeoutput.cellpath LIKE '%intake...
eicu
CREATE TABLE table_name_89 ( year INTEGER, accolade VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the highest year with rank of 22 and accolade of singles of 1999
SELECT MAX(year) FROM table_name_89 WHERE accolade = "singles of 1999" AND rank = "22"
sql_create_context
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, uniquepi...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT intakeoutput.patientunitstayid FROM intakeoutput WHERE intakeoutput.celllabel = 'enteral tube intake: nasogastric nostril, l 12fr' AND intakeoutput.cellpath LIKE '%input%')
eicu
CREATE TABLE table_28344 ( "Road race" text, "Distance" text, "Location" text, "Country" text, "Month held" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are all of the area where distance is marathon and month held is february
SELECT "Location" FROM table_28344 WHERE "Distance" = 'Marathon' AND "Month held" = 'February'
wikisql
CREATE TABLE table_29942205_1 ( country_territory VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many women has got the first runner-up position in representation of Philippines?
SELECT 1 AS st_runner_up FROM table_29942205_1 WHERE country_territory = "Philippines"
sql_create_context
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 procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, ...
SELECT admissions.subject_id FROM admissions WHERE admissions.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'tot anom pulm ven connec'))
mimic_iii
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test...
SELECT DISTINCT course_offering.end_time, course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.start_time, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM semester INNER JOIN course_offering ON semester.semester_id = course_o...
advising
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 mzjzjlb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND 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 table_204_312 ( id number, "stage" text, "date" text, "route" text, "terrain" text, "length" text, "winner" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many miles is the metz - nancy route ?
SELECT "length" FROM table_204_312 WHERE "route" = 'metz - nancy'
squall
CREATE TABLE table_7497 ( "Unemployment" text, "2007-03" real, "2008-03" real, "2009-03" real, "2010-03" real, "2011-03" real, "2012-03" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest 2010-03, when 2008-03 is less than 9....
SELECT MAX("2010-03") FROM table_7497 WHERE "2008-03" < '9.9' AND "2011-03" < '11.8' AND "Unemployment" = 'czech republic'
wikisql
CREATE TABLE table_23392257_4 ( original_airdate VARCHAR, _number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date did Episode 22 originally air?
SELECT COUNT(original_airdate) FROM table_23392257_4 WHERE _number = 22
sql_create_context
CREATE TABLE table_203_269 ( id number, "season" text, "competition" text, "round" text, "club" text, "home" text, "away" text, "aggregate" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the last competition they competed in ?
SELECT "competition" FROM table_203_269 ORDER BY id DESC LIMIT 1
squall
CREATE TABLE table_203_695 ( id number, "draw" number, "artist" text, "song" text, "points" number, "place" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- in the irish national final for the eurovision song contest in 1990 , the artist singing w...
SELECT "artist" FROM table_203_695 WHERE "place" = 3
squall
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 WHERE demographic.diagnosis = "NEOPLASM OF UNCERTAIN BEHAVIOR OF OTHER LYMPHATIC AND HEMATOPOIETIC TISSUES\BONE MARROW TRANSPLANT" AND demographic.dod_year <= "2174.0"
mimicsql_data
CREATE TABLE table_name_75 ( week INTEGER, winning_team VARCHAR, event VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many weeks have a Winning team of yellow team, and an Event of foos it or lose it?
SELECT SUM(week) FROM table_name_75 WHERE winning_team = "yellow team" AND event = "foos it or lose it"
sql_create_context
CREATE TABLE bdmzjzjlb ( 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 wdmzjzjlb.JZLSH FROM person_info JOIN hz_info JOIN wdmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE person_info.XM = '尤安晏' AND hz_info.YLJGDM = '7400991' AND wdmzjzjlb.JZKSMC LIKE '%肝胆科%' UNION SELECT bdmzjzjlb....
css
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND prescriptions.drug = "Topiramate (Topamax)"
mimicsql_data
CREATE TABLE table_28704 ( "Rank" real, "Athlete" text, "Country" text, "Distance (metres)" text, "Points" text, "Adjusted Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of times points were listed when the dista...
SELECT COUNT("Points") FROM table_28704 WHERE "Distance (metres)" = '41.05'
wikisql
CREATE TABLE table_35523 ( "Position" real, "Team" text, "Played" real, "Wins" real, "Draws" real, "Losses" real, "Scored" real, "Conceded" real, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the lowest number of w...
SELECT MIN("Wins") FROM table_35523 WHERE "Position" = '7' AND "Scored" > '14'
wikisql
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0),...
SELECT EMAIL, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMPLOYEE_ID
nvbench
CREATE TABLE table_22358 ( "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (in millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the title of the episode directe...
SELECT "Title" FROM table_22358 WHERE "Directed by" = 'John T. Kretchmer'
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "NEWBORN" AND procedures.short_title = "Vaccination NEC"
mimicsql_data
CREATE TABLE table_241 ( "Model" text, "Engine make/Capacity" text, "Power kW@rpm" text, "Torque Nm@rpm" text, "Transmission Make/Type/Speed" text, "GVM (kg) Technical Capacity" text, "GCM (kg) Technical Capacity" text ) -- Using valid SQLite, answer the following questions for the tables ...
SELECT "Model" FROM table_241 WHERE "GVM (kg) Technical Capacity" = '16000' AND "Torque Nm@rpm" = '600 @ 1700'
wikisql