instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_name_84 ( winner_2nd VARCHAR, jockey VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHo is Winner/2nd that has c. symons?
SELECT winner_2nd FROM table_name_84 WHERE jockey = "c. symons"
sql_create_context
CREATE TABLE table_name_35 ( l1_cache VARCHAR, fsb_speed VARCHAR, clock_speed VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which L1 Cache has an FSB speed of 800mhz and a clock speed of 1.2ghz?
SELECT l1_cache FROM table_name_35 WHERE fsb_speed = "800mhz" AND clock_speed = "1.2ghz"
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND procedures.icd9_code = "7761"
mimicsql_data
CREATE TABLE table_41053 ( "Year" real, "Actor" text, "Award" text, "Motion Picture" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the latest year that Cicely Tyson is the Golden Globe Award actor?
SELECT MAX("Year") FROM table_41053 WHERE "Actor" = 'cicely tyson'
wikisql
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT t_kc24.t_kc21_IN_DIAG_DIS_CD, t_kc24.t_kc21_IN_DIAG_DIS_NM FROM t_kc24 WHERE t_kc24.t_kc21_PERSON_ID = '91530632' AND t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 4446.07)
css
CREATE TABLE table_name_33 ( silver INTEGER, rank VARCHAR, bronze VARCHAR, total VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the smallest silver with a Bronze smaller than 6, a Total of 3, and a Rank smaller than 9?
SELECT MIN(silver) FROM table_name_33 WHERE bronze < 6 AND total = 3 AND rank < 9
sql_create_context
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid num...
SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 3
eicu
CREATE TABLE CUSTOMER ( FirstName VARCHAR, LastName VARCHAR, Email VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the first name and last name of the customer that has email 'luisg@embraer.com.br'?
SELECT FirstName, LastName FROM CUSTOMER WHERE Email = "luisg@embraer.com.br"
sql_create_context
CREATE TABLE table_16668 ( "Round" real, "Grand Prix" text, "Date" text, "Location" text, "Pole Position" text, "Fastest Lap" text, "Winning Driver" text, "Winning Constructor" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above...
SELECT "Location" FROM table_16668 WHERE "Fastest Lap" = 'Thierry Boutsen'
wikisql
CREATE TABLE table_3203 ( "Team" text, "#" real, "Car Sponsor(s)" text, "Driver(s)" text, "Listed Owner(s)" text, "Engine" text, "Chassis" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What engine does the Fuzzy's Ultra Premium Vodka sponso...
SELECT "Engine" FROM table_3203 WHERE "Car Sponsor(s)" = 'Fuzzy''s Ultra Premium Vodka'
wikisql
CREATE TABLE perpetrator ( Id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many perpetrators are there?
SELECT COUNT(*) FROM perpetrator
sql_create_context
CREATE TABLE weather ( date VARCHAR, mean_temperature_f VARCHAR, mean_humidity VARCHAR, max_gust_speed_mph VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the date, mean temperature and mean humidity for the top 3 days with the largest max gu...
SELECT date, mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3
sql_create_context
CREATE TABLE table_name_92 ( score VARCHAR, january INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score in January that was less than 4?
SELECT score FROM table_name_92 WHERE january < 4
sql_create_context
CREATE TABLE table_name_67 ( to_par VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the To par has the presence of Vijay Singh?
SELECT to_par FROM table_name_67 WHERE player = "vijay singh"
sql_create_context
CREATE TABLE table_name_91 ( bronze INTEGER, total INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of Bronze when the total is more than 27?
SELECT SUM(bronze) FROM table_name_91 WHERE total > 27
sql_create_context
CREATE TABLE table_39056 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponent" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What person was played against when the playing surface was ha...
SELECT "Opponent" FROM table_39056 WHERE "Surface" = 'hard'
wikisql
CREATE TABLE table_name_95 ( runner_up VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What runner-up has 2008 as the year?
SELECT runner_up FROM table_name_95 WHERE year = "2008"
sql_create_context
CREATE TABLE table_42785 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What team was the Away team when the Tie no was 3?
SELECT "Away team" FROM table_42785 WHERE "Tie no" = '3'
wikisql
CREATE TABLE table_55815 ( "Locomotive" text, "Serial No" text, "Entered service" text, "Gauge" text, "Livery" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the date of entered service for the locomotive with a broad gauge and a serial no o...
SELECT "Entered service" FROM table_55815 WHERE "Gauge" = 'broad' AND "Serial No" = '83-1018'
wikisql
CREATE TABLE table_68581 ( "Frequency" real, "Callsign" text, "Brand" text, "Format" text, "City of License" text, "Website" text, "Webcast" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the sum of frequecy with brand of exa fm
SELECT SUM("Frequency") FROM table_68581 WHERE "Brand" = 'exa fm'
wikisql
CREATE TABLE table_203_134 ( id number, "place" text, "player" text, "country" text, "score" text, "to par" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many players tied for fourth place ?
SELECT COUNT("player") FROM table_203_134 WHERE "place" = 4
squall
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC...
SELECT zzmzjzjlb.ZZYSGH, zzmzjzjlb.QTJZYSGH FROM zzmzjzjlb WHERE zzmzjzjlb.JZLSH = '16949706262' UNION SELECT fzzmzjzjlb.ZZYSGH, fzzmzjzjlb.QTJZYSGH FROM fzzmzjzjlb WHERE fzzmzjzjlb.JZLSH = '16949706262'
css
CREATE TABLE table_name_73 ( appointed_by VARCHAR, judge VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who appointed Judge Edward E. Cushman?
SELECT appointed_by FROM table_name_73 WHERE judge = "edward e. cushman"
sql_create_context
CREATE TABLE perpetrator ( Perpetrator_ID int, People_ID int, Date text, Year real, Location text, Country text, Killed int, Injured int ) CREATE TABLE people ( People_ID int, Name text, Height real, Weight real, "Home Town" text ) -- Using valid SQLite, answer the...
SELECT Country, COUNT(*) FROM perpetrator GROUP BY Country ORDER BY COUNT(*)
nvbench
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE cost ( c...
SELECT MIN(vitalperiodic.temperature) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '033-22108')) AND NOT vitalperiodic.temperature IS ...
eicu
CREATE TABLE table_23555 ( "Year" real, "Starts" real, "Wins" real, "Top 10" real, "Poles" real, "Avg. Start" text, "Avg. Finish" text, "Winnings" text, "Position" text, "Team(s)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- st...
SELECT "Winnings" FROM table_23555 WHERE "Poles" = '0' AND "Team(s)" = 'Yates Racing Front Row Motorsports'
wikisql
CREATE TABLE table_53966 ( "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 team has a Venue at Lake Oval?
SELECT "Away team" FROM table_53966 WHERE "Venue" = 'lake oval'
wikisql
CREATE TABLE table_204_291 ( id number, "rank" number, "name" text, "nation" text, "cp" number, "fp" number, "points" number, "placings" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many skaters had points greater than 2600 ?
SELECT COUNT("name") FROM table_204_291 WHERE "points" > 2600
squall
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Votes ( Id number, PostId number, ...
SELECT Users.Id AS "user_link", Users.Reputation AS Reputation, COUNT(Posts.Id) AS Answers, CAST(AVG(CAST(Score AS FLOAT)) AS FLOAT(6, 2)) AS "average_answer_score" FROM Posts INNER JOIN Users ON Users.Id = OwnerUserId WHERE PostTypeId = 2 AND CommunityOwnedDate IS NULL AND ClosedDate IS NULL AND Users.Reputation > 500...
sede
CREATE TABLE table_name_45 ( duration VARCHAR, soap_opera VARCHAR, actor VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the duration of the Archers with Pauline Seville acting?
SELECT duration FROM table_name_45 WHERE soap_opera = "the archers" AND actor = "pauline seville"
sql_create_context
CREATE TABLE table_26236 ( "Rank by Average" real, "Place" real, "Couple" text, "Total Points Earned" real, "Number of Dances" real, "Average" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the average score for the couple that had 4 da...
SELECT "Average" FROM table_26236 WHERE "Number of Dances" = '4'
wikisql
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImage...
SELECT UserId AS "user_link", PostId AS "post_link", COUNT(*) AS Bounties FROM Votes WHERE VoteTypeId = 8 AND CreationDate >= '2011-09-09 11:00:00' GROUP BY UserId, PostId ORDER BY Bounties DESC
sede
CREATE TABLE table_9971 ( "Game" real, "March" real, "Opponent" text, "Score" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest Game, when Opponent is 'Boston Bruins'?
SELECT MIN("Game") FROM table_9971 WHERE "Opponent" = 'boston bruins'
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "45" AND procedures.long_title = "Parenteral infusion of concentrated nutritional substances"
mimicsql_data
CREATE TABLE table_28540428_3 ( event_3_deadlift VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the event 3 deadlift for hennie jordan
SELECT event_3_deadlift FROM table_28540428_3 WHERE name = "Hennie Jordan"
sql_create_context
CREATE TABLE table_name_50 ( rank VARCHAR, year VARCHAR, chassis VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the rank of the reynard 2ki chassis before 2002?
SELECT rank FROM table_name_50 WHERE year < 2002 AND chassis = "reynard 2ki"
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Fall on stair/step NEC" AND prescriptions.route = "BUCCAL"
mimicsql_data
CREATE TABLE table_972 ( "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 20...
SELECT COUNT("Android") FROM table_972 WHERE "Quarter" = '2012 Q4'
wikisql
CREATE TABLE table_name_3 ( ncaa_tourn_appearances VARCHAR, coach VARCHAR, conference_titles VARCHAR, ncaa_titles VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which NCAA Tournament Appearances have Conference Titles that are larger than 0, NCAA Tit...
SELECT ncaa_tourn_appearances FROM table_name_3 WHERE conference_titles > "0" AND ncaa_titles = "0" AND coach = "lou watson"
sql_create_context
CREATE TABLE table_27625 ( "Episode" text, "Theme" text, "Song choice" text, "Original artist" text, "Order #" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result where the original artist is Prince and the Revolutio...
SELECT "Result" FROM table_27625 WHERE "Original artist" = 'Prince and The Revolution'
wikisql
CREATE TABLE actor ( actor_id number, name text, musical_id number, character text, duration text, age number ) CREATE TABLE musical ( musical_id number, name text, year number, award text, category text, nominee text, result text ) -- Using valid SQLite, answer th...
SELECT character, duration FROM actor
spider
CREATE TABLE table_204_933 ( id number, "year" number, "competition" text, "date" text, "location" text, "opponent" text, "score" text, "result" text, "bye" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- tell me the number of times t...
SELECT COUNT(*) FROM table_204_933 WHERE "result" = 'win'
squall
CREATE TABLE table_name_82 ( Id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the 2004 that has a of grand slam tournaments in2006 ?
SELECT 2004 FROM table_name_82 WHERE 2006 = "grand slam tournaments"
sql_create_context
CREATE TABLE table_8298 ( "Player" text, "Wkts" real, "Runs" real, "Econ" real, "Ovrs" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest Ovrs, when Wkts is greater than 13, and when Econ is less than 3.21?
SELECT MIN("Ovrs") FROM table_8298 WHERE "Wkts" > '13' AND "Econ" < '3.21'
wikisql
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 T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T1.Code
nvbench
CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number...
SELECT CAST(TIME_TO_STR(CreationDate, '%Y-%m-%d %H:%M:%S') AS TEXT(7)) AS "month", COUNT(*) AS "torch_count" FROM Posts AS p WHERE p.PostTypeId = 1 AND p.Tags LIKE '%<torch>%' GROUP BY CAST(TIME_TO_STR(CreationDate, '%Y-%m-%d %H:%M:%S') AS TEXT(7)) ORDER BY month
sede
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, ic...
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'sepsis' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '...
eicu
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number...
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 20 AND 29) AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY pres...
mimic_iii
CREATE TABLE party ( party_id number, year number, party text, governor text, lieutenant_governor text, comptroller text, attorney_general text, us_senate text ) CREATE TABLE county ( county_id number, county_name text, population number, zip_code text ) CREATE TABLE el...
SELECT * FROM election
spider
CREATE TABLE table_67128 ( "Year" real, "Event" text, "Venue" text, "Driver" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year was the Spanish Grand Prix where Emerson Fittipaldi drove?
SELECT "Year" FROM table_67128 WHERE "Event" = 'spanish grand prix' AND "Driver" = 'emerson fittipaldi'
wikisql
CREATE TABLE table_57510 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average number of laps for the driver Piero Taruffi?
SELECT AVG("Laps") FROM table_57510 WHERE "Driver" = 'piero taruffi'
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_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '章乐悦' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC
css
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 JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(DEPARTMENT_ID)
nvbench
CREATE TABLE table_name_52 ( round VARCHAR, against VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the round for 29 January 1949, when the against was 1?
SELECT round FROM table_name_52 WHERE against = 1 AND date = "29 january 1949"
sql_create_context
CREATE TABLE table_25016555_5 ( assists INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest overall amount of assists?
SELECT MIN(assists) FROM table_25016555_5
sql_create_context
CREATE TABLE table_55200 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the opponent for the Sutton tournament?
SELECT "Opponents" FROM table_55200 WHERE "Tournament" = 'sutton'
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 SUM(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '9719119' AND t_kc21.MED_ORG_DEPT_CD = '9117') AND t_kc24.CLINIC_SLT_DATE BETWEEN '2000-09-02' AND '2007-02-07'
css
CREATE TABLE competition_result ( Competition_ID int, Club_ID_1 int, Club_ID_2 int, Score text ) CREATE TABLE club ( Club_ID int, name text, Region text, Start_year text ) CREATE TABLE club_rank ( Rank real, Club_ID int, Gold real, Silver real, Bronze real, Tota...
SELECT Position, COUNT(*) FROM player WHERE Points < 30 GROUP BY Position ORDER BY COUNT(*)
nvbench
CREATE TABLE table_76572 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many total golds do teams have when the total medals is less than 1?
SELECT SUM("Gold") FROM table_76572 WHERE "Total" < '1'
wikisql
CREATE TABLE table_55476 ( "Rank" real, "Player" text, "Country" text, "Earnings ( $ )" real, "Events" real, "Wins" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the high earnings for players with 34 events and over 2 wins?
SELECT MAX("Earnings ( $ )") FROM table_55476 WHERE "Events" = '34' AND "Wins" > '2'
wikisql
CREATE TABLE table_20250 ( "Date" text, "Cover model" text, "Centerfold model" text, "Interview subject" text, "20 Questions" text, "Pictorials" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- IN WHAT ISSUE OF PLAYBOY WAS SHEPARD SMITH INTERVIEWE...
SELECT "Date" FROM table_20250 WHERE "Interview subject" = 'Shepard Smith'
wikisql
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
SELECT COUNT(person_info.RYBH) 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.YLJGD...
css
CREATE TABLE table_name_79 ( year INTEGER, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the earliest year for 9 points?
SELECT MIN(year) FROM table_name_79 WHERE points = 9
sql_create_context
CREATE TABLE table_68427 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the earliest year for the Ligier Gitanes?
SELECT MIN("Year") FROM table_68427 WHERE "Entrant" = 'ligier gitanes'
wikisql
CREATE TABLE table_name_16 ( attendance VARCHAR, result VARCHAR, week VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total attendance in a week less than 5 when the result was l 24-20?
SELECT COUNT(attendance) FROM table_name_16 WHERE result = "l 24-20" AND week < 5
sql_create_context
CREATE TABLE table_37593 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what team won the friendly match
SELECT "Result" FROM table_37593 WHERE "Competition" = 'friendly match'
wikisql
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE T...
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY SUM(DEPARTMENT_ID)
nvbench
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 COUNT(*) FROM zyjzjlb WHERE JZKSMC = '化疗科' AND RYDJSJ BETWEEN '2007-11-14' AND '2020-09-19'
css
CREATE TABLE table_74336 ( "Team" text, "Stadium" text, "Home Games" real, "Average Attendance" real, "Total Attendance" real, "Capacity Percentage" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was average attendance when total attendance...
SELECT "Average Attendance" FROM table_74336 WHERE "Total Attendance" = '541380'
wikisql
CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int,...
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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.departure_time > 200 AND flight.to_airport = AIRPORT_SERVICE_1....
atis
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 jybgb.BBCJBW 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 = '70148968' AND jybgb.BGRQ BETWEEN '2007-08-06' AND '202...
css
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline...
SELECT DISTINCT ground_service.transport_type FROM airport, ground_service WHERE airport.airport_code = 'SFO' AND ground_service.airport_code = airport.airport_code
atis
CREATE TABLE stadium ( id int, name text, Home_Games int, Average_Attendance real, Total_Attendance real, Capacity_Percentage real ) CREATE TABLE game ( stadium_id int, id int, Season int, Date text, Home_team text, Away_team text, Score text, Competition text ) ...
SELECT Home_team, COUNT(Home_team) FROM game GROUP BY Home_team
nvbench
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 (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-1517' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospit...
eicu
CREATE TABLE table_name_27 ( sprint_points VARCHAR, total_points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many sprint points contribute to 2 total points?
SELECT sprint_points FROM table_name_27 WHERE total_points = "2"
sql_create_context
CREATE TABLE table_name_70 ( country VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the country of cordier?
SELECT country FROM table_name_70 WHERE name = "cordier"
sql_create_context
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 MAX(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.discharge_location = "HOME"
mimicsql_data
CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, ...
SELECT DATEADD(DAY, -(DATEPART(DAY, rtr.CreationDate) % 30), rtr.CreationDate) AS "date", COUNT(rt.Id) AS "reviews_completed" FROM ReviewTasks AS rt INNER JOIN ReviewTaskResults AS rtr ON rtr.ReviewTaskId = rt.Id WHERE rt.ReviewTaskStateId = 2 GROUP BY DATEADD(DAY, -(DATEPART(DAY, rtr.CreationDate) % 30), rtr.CreationD...
sede
CREATE TABLE table_61258 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of bronze medals for teams with less than 0 silver?
SELECT COUNT("Bronze") FROM table_61258 WHERE "Silver" < '0'
wikisql
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, ...
SELECT low.Id AS "post_link", low.Id AS LowId, low.CreationDate AS LowDate, hi.Id AS "high_link", hi.CreationDate AS HighDate FROM Posts AS low, Posts AS hi WHERE low.Id > hi.Id AND low.CreationDate < hi.CreationDate AND low.CreationDate > '1 jan 2012' AND hi.CreationDate > '1 jan 2012'
sede
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
WITH answers AS (SELECT a.OwnerUserId AS UserId, 1.0 / RANK() OVER (PARTITION BY q.Id ORDER BY a.Score DESC) AS utility, 1.0 * q.AnswerCount AS debatableness, 1.0 / RANK() OVER (PARTITION BY q.Id ORDER BY a.Score DESC) * q.AnswerCount / @tag_debate AS EC FROM Posts AS q JOIN Posts AS a ON q.Id = a.ParentId JOIN PostTag...
sede
CREATE TABLE table_name_83 ( score VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the score of bert yancey
SELECT score FROM table_name_83 WHERE player = "bert yancey"
sql_create_context
CREATE TABLE classroom ( building varchar(15), room_number varchar(7), capacity numeric(4,0) ) CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varchar(20), tot_cred numeric(3,0) ) CREATE TABLE section ( course_id varchar(8), sec_id varchar(8), semester varchar...
SELECT dept_name, COUNT(*) FROM student GROUP BY dept_name ORDER BY COUNT(*)
nvbench
CREATE TABLE table_76470 ( "Round" real, "Selection" real, "Player" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Selection has a College of texas a&m?
SELECT SUM("Selection") FROM table_76470 WHERE "College" = 'texas a&m'
wikisql
CREATE TABLE table_name_33 ( date VARCHAR, competition VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In the 1936 summer Olympics what was the date of a match that ended with a score of 6-1?
SELECT date FROM table_name_33 WHERE competition = "1936 summer olympics" AND score = "6-1"
sql_create_context
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
SELECT PERSON_NM, PERSON_SEX, PERSON_AGE, IDENTITY_CARD FROM t_kc21 WHERE MED_CLINIC_ID = '24731815249'
css
CREATE TABLE table_20816 ( "Pick #" real, "CFL Team" text, "Player" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What position did Gene Stahl play
SELECT "Position" FROM table_20816 WHERE "Player" = 'Gene Stahl'
wikisql
CREATE TABLE table_22329326_1 ( owned_since VARCHAR, station VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was the station WLS-TV owned since?
SELECT owned_since FROM table_22329326_1 WHERE station = "WLS-TV"
sql_create_context
CREATE TABLE table_13071 ( "Actor/actress" text, "Character" text, "Rank" text, "Tenure" text, "Episodes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Rank of the Character with Tenure of 2011?
SELECT "Rank" FROM table_13071 WHERE "Tenure" = '2011'
wikisql
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 student_record ( student_id int, course_id int, semester i...
SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%Core%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_co...
advising
CREATE TABLE table_21578303_2 ( stage VARCHAR, time__eet_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which stage has 15:17 as time?
SELECT stage FROM table_21578303_2 WHERE time__eet_ = "15:17"
sql_create_context
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_ID = '75340002' AND t_kc22.STA_DATE BETWEEN '2004-08-08' AND '2019-09-03' AND t_kc22.SELF_PAY_AMO > 8808.11
css
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE Badges ( Id number, UserId number, Name text, ...
SELECT COUNT(*) / (SUM(CASE WHEN acc.Id != NULL THEN 1 ELSE 0 END) + 1) AS rate FROM Users INNER JOIN Posts AS q ON q.OwnerUserId = Users.Id INNER JOIN PostTags AS pt ON q.Id = pt.PostId INNER JOIN Tags AS t ON t.Id = pt.TagId LEFT OUTER JOIN Posts AS acc ON acc.Id = q.AcceptedAnswerId INNER JOIN Posts AS ans ON ans.Pa...
sede
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 AVG(demographic.age) FROM demographic WHERE demographic.diagnosis = "COPD EXACERBATION" AND demographic.dod_year < "2158.0"
mimicsql_data
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, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH 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_name_21 ( runner_s__up VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Runner(s)-up has a Date of may 19, 1973?
SELECT runner_s__up FROM table_name_21 WHERE date = "may 19, 1973"
sql_create_context
CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time...
SELECT DISTINCT fare_basis_code FROM fare_basis WHERE fare_basis_code = 'QX'
atis
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 wdmzjzjlb JOIN jybgb ON wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE wdmzjzjlb.YLJGDM = '9602560' AND jybgb.BGRQ BETWEEN '2004-10-17' AND '2016-06-04' GROUP BY jybgb.KSBM HAVING COUNT(*) > 27 UNION SELECT jybgb.KSBM FROM bdmzjzjlb J...
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 lab ( labid numb...
SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-85328')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutpu...
eicu
CREATE TABLE table_38990 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest total for the silver less than 1, and a rank more than 5, more than 1 bro...
SELECT MIN("Total") FROM table_38990 WHERE "Silver" < '1' AND "Rank" > '5' AND "Bronze" > '1'
wikisql