instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_16296 ( "Season" text, "Series" text, "Team Name" text, "Races" real, "Wins" real, "Poles" real, "F/Laps" real, "Podiums" real, "Points" text, "Position" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many ...
SELECT "Races" FROM table_16296 WHERE "Season" = '2009' AND "Wins" = '0'
wikisql
CREATE TABLE table_56610 ( "Goal" real, "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result on 8 October 1961?
SELECT "Result" FROM table_56610 WHERE "Date" = '8 october 1961'
wikisql
CREATE TABLE table_10748 ( "Date" text, "Name" text, "Flag" text, "Tonnage (GRT)" real, "Sunk by" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the date for the flag of Norway?
SELECT "Date" FROM table_10748 WHERE "Flag" = 'norway'
wikisql
CREATE TABLE table_name_71 ( date VARCHAR, competition VARCHAR, venue VARCHAR ) -- 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_name_71 WHERE competition = "friendly" AND venue = "rheinpark stadion, vaduz"
sql_create_context
CREATE TABLE table_name_3 ( away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When collingwood played as the away team what did they score?
SELECT away_team AS score FROM table_name_3 WHERE away_team = "collingwood"
sql_create_context
CREATE TABLE table_43400 ( "Number" real, "Class" real, "Name" text, "Livery" text, "Notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Class when Wessex Trains Pink is the Livery?
SELECT "Class" FROM table_43400 WHERE "Livery" = 'wessex trains pink'
wikisql
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 course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Esther Wipfler%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id ...
advising
CREATE TABLE table_13079788_3 ( round INTEGER, gt3_winner VARCHAR, pole_position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the maximum round for gt3 winner hector lester tim mullen and pole position of jonny cocker paul drayson
SELECT MAX(round) FROM table_13079788_3 WHERE gt3_winner = "Hector Lester Tim Mullen" AND pole_position = "Jonny Cocker Paul Drayson"
sql_create_context
CREATE TABLE table_name_42 ( bowl_game VARCHAR, season VARCHAR, location VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the Bowl game in San Francisco, CA after 1968?
SELECT bowl_game FROM table_name_42 WHERE season > 1968 AND location = "san francisco, ca"
sql_create_context
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE jobs ( JOB_ID varchar(...
SELECT LAST_NAME, DEPARTMENT_ID FROM employees ORDER BY LAST_NAME
nvbench
CREATE TABLE table_name_28 ( engine VARCHAR, rounds VARCHAR, entrant VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What kind of engine is in the car for Scuderia Ferrari that went all rounds?
SELECT engine FROM table_name_28 WHERE rounds = "all" AND entrant = "scuderia ferrari"
sql_create_context
CREATE TABLE table_41409 ( "Name" text, "Status" text, "Authors" text, "Location" text, "Notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of gao chiappe meng o'connor wang cheng liu?
SELECT "Name" FROM table_41409 WHERE "Authors" = 'gao chiappe meng o''connor wang cheng liu'
wikisql
CREATE TABLE table_name_27 ( award VARCHAR, work VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which award did Scream receive a nomination and/or win for in 1997?
SELECT award FROM table_name_27 WHERE work = "scream" AND year = 1997
sql_create_context
CREATE TABLE Catalog_Structure ( catalog_level_number INTEGER, catalog_id INTEGER, catalog_level_name VARCHAR(50) ) CREATE TABLE Attribute_Definitions ( attribute_id INTEGER, attribute_name VARCHAR(30), attribute_data_type VARCHAR(10) ) CREATE TABLE Catalog_Contents ( catalog_entry_id INTE...
SELECT catalog_entry_name, capacity FROM Catalog_Contents WHERE price_in_dollars > 700 ORDER BY catalog_entry_name
nvbench
CREATE TABLE table_name_55 ( loss VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which loss has an Attendance of 23,952?
SELECT loss FROM table_name_55 WHERE attendance = "23,952"
sql_create_context
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-16123')) AND DATETIME(microlab.culturetakentime, 'start of year') = DATETI...
eicu
CREATE TABLE table_12555835_1 ( population__region_total_ VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many figures are given for the region's total in 1947?
SELECT COUNT(population__region_total_) FROM table_12555835_1 WHERE year = 1947
sql_create_context
CREATE TABLE match_season ( Season real, Player text, Position text, Country int, Team int, Draft_Pick_Number int, Draft_Class text, College text ) CREATE TABLE team ( Team_id int, Name text ) CREATE TABLE country ( Country_id int, Country_name text, Capital text, ...
SELECT Years_Played, COUNT(Years_Played) FROM player GROUP BY Years_Played ORDER BY COUNT(Years_Played)
nvbench
CREATE TABLE table_name_2 ( females_rank INTEGER, state VARCHAR, females___percentage_ VARCHAR, hiv_awareness__males_percentage_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Females Rank is the highest one that has Females (%) larger than 53,...
SELECT MAX(females_rank) FROM table_name_2 WHERE females___percentage_ > 53 AND hiv_awareness__males_percentage_ < 89 AND state = "odisha"
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 demographic.admission_type FROM demographic WHERE demographic.subject_id = "11221"
mimicsql_data
CREATE TABLE table_37992 ( "Date" text, "Opponent" text, "Site" text, "Result" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Date at memorial stadium minneapolis, mn, and an Opponent of northwestern?
SELECT "Date" FROM table_37992 WHERE "Site" = 'memorial stadium • minneapolis, mn' AND "Opponent" = 'northwestern'
wikisql
CREATE TABLE table_name_46 ( date_made VARCHAR, notes VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When has a Note of 45/48 renumbered 15/16; two sold to sl&ncr?
SELECT date_made FROM table_name_46 WHERE notes = "45/48 renumbered 15/16; two sold to sl&ncr"
sql_create_context
CREATE TABLE table_name_96 ( elevation_ VARCHAR, _height VARCHAR, delivery VARCHAR, location VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Elevation + Height has a Delivery of barge and a Location of bikini, yurochi aka irioj (dog)?
SELECT elevation_ + _height FROM table_name_96 WHERE delivery = "barge" AND location = "bikini, yurochi aka irioj (dog)"
sql_create_context
CREATE TABLE table_23417 ( "Team" text, "Truck(s)" text, "#" real, "Driver(s)" text, "Primary Sponsor(s)" text, "Listed Owner(s)" text, "Crew Chief" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What number truck is owned by Stephen Germain...
SELECT "#" FROM table_23417 WHERE "Listed Owner(s)" = 'Stephen Germain'
wikisql
CREATE TABLE table_2259502_2 ( outcome VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the outcome in games where the score was 7-5, 2-6, [6-10]?
SELECT outcome FROM table_2259502_2 WHERE score = "7-5, 2-6, [6-10]"
sql_create_context
CREATE TABLE table_48353 ( "Discipline" text, "Championship" text, "Circuit" text, "Event" text, "Session" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In the Indianapolis Sweepstakes race session, what is the championship?
SELECT "Championship" FROM table_48353 WHERE "Session" = 'race' AND "Event" = 'indianapolis sweepstakes'
wikisql
CREATE TABLE table_name_57 ( qual INTEGER, grid VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total qual where the grid number is 24?
SELECT SUM(qual) FROM table_name_57 WHERE grid = 24
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51229"
mimicsql_data
CREATE TABLE table_name_38 ( episode VARCHAR, money_requested__£_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Episode has requested 150,000?
SELECT episode FROM table_name_38 WHERE money_requested__£_ = "150,000"
sql_create_context
CREATE TABLE candidate ( candidate_id number, people_id number, poll_source text, date text, support_rate number, consider_rate number, oppose_rate number, unsure_rate number ) CREATE TABLE people ( people_id number, sex text, name text, date_of_birth text, height nu...
SELECT * FROM people
spider
CREATE TABLE table_24673710_1 ( winning_boat VARCHAR, entries VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When 61 is the entries what is the winning boat?
SELECT winning_boat FROM table_24673710_1 WHERE entries = 61
sql_create_context
CREATE TABLE table_78880 ( "Pick #" real, "Brand (to)" text, "Employee (Real name)" text, "Role" text, "Brand (from)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the real name of the Pick # that is greater than 9?
SELECT "Employee (Real name)" FROM table_78880 WHERE "Pick #" > '9'
wikisql
CREATE TABLE table_name_56 ( name VARCHAR, winning_constructor VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Name has a Winning constructor of ansaldo?
SELECT name FROM table_name_56 WHERE winning_constructor = "ansaldo"
sql_create_context
CREATE TABLE table_name_82 ( attendance VARCHAR, time VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of people in attendance when the time is 3:00?
SELECT attendance FROM table_name_82 WHERE time = "3:00"
sql_create_context
CREATE TABLE county ( County_Id int, County_name text, Population real, Zip_code text ) CREATE TABLE election ( Election_ID int, Counties_Represented text, District int, Delegate text, Party int, First_Elected real, Committee text ) CREATE TABLE party ( Party_ID int, ...
SELECT T2.Party, COUNT(T2.Party) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T2.Party
nvbench
CREATE TABLE table_203_339 ( id number, "year" text, "car" number, "start" number, "qual" number, "rank" number, "finish" number, "laps" number, "led" number, "retired" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- number of tim...
SELECT COUNT(*) FROM table_203_339 WHERE "retired" = 'running'
squall
CREATE TABLE table_60276 ( "Model" text, "Year" text, "Type" text, "Engine" text, "Displacement cc" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What cc displacement has an i6 engine in 1936?
SELECT "Displacement cc" FROM table_60276 WHERE "Engine" = 'i6' AND "Year" = '1936'
wikisql
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, ...
SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'stres...
eicu
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Mal neo descend colon" AND prescriptions.drug_type = "MAIN"
mimicsql_data
CREATE TABLE Locations ( Location_ID INTEGER, Location_Name VARCHAR(255), Address VARCHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Tourist_Attractions ( Tourist_Attraction_ID INTEGER, Attraction_Type_Code CHAR(15), Location_ID INTEGER, How_to_Get_There VARCHAR(255), Name VARC...
SELECT Visit_Date, COUNT(Visit_Date) FROM Visits ORDER BY Visit_Date
nvbench
CREATE TABLE table_15985 ( "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. -- What score did Goodman give to all songs with ...
SELECT "Goodman" FROM table_15985 WHERE "Total" = '31' AND "Horwood" = '7' AND "Result" = 'Safe'
wikisql
CREATE TABLE table_44334 ( "Edition" text, "Round" text, "Date" text, "Partnering" text, "Against" text, "Surface" text, "Opponents" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was partnering when nueza silva played...
SELECT "Partnering" FROM table_44334 WHERE "Against" = 'greece'
wikisql
CREATE TABLE table_37074 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Save" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which opponent has a save of smith (22)?
SELECT "Opponent" FROM table_37074 WHERE "Save" = 'smith (22)'
wikisql
CREATE TABLE table_name_30 ( bronze INTEGER, rank VARCHAR, total VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest Bronze with a 17 Rank and a Total less than 5
SELECT MIN(bronze) FROM table_name_30 WHERE rank = "17" AND total < 5
sql_create_context
CREATE TABLE player ( player_id number, player text, years_played text, total_wl text, singles_wl text, doubles_wl text, team number ) CREATE TABLE country ( country_id number, country_name text, capital text, official_native_language text ) CREATE TABLE team ( team_id ...
SELECT COUNT(DISTINCT T1.official_native_language) FROM country AS T1 JOIN match_season AS T2 ON T1.country_id = T2.country WHERE T2.position = "Defender"
spider
CREATE TABLE table_name_19 ( match INTEGER, points VARCHAR, draw VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number for match when the draws in more than 0, the team is Polonia Bydgoszcz, and there are less than 17 points...
SELECT SUM(match) FROM table_name_19 WHERE draw > 0 AND team = "polonia bydgoszcz" AND points < 17
sql_create_context
CREATE TABLE Addresses ( address_id VARCHAR, zip_postcode VARCHAR ) CREATE TABLE Teachers ( email_address VARCHAR, address_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the email addresses of teachers whose address has zip code '918'?
SELECT T2.email_address FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T1.zip_postcode = "918"
sql_create_context
CREATE TABLE table_name_56 ( original_title VARCHAR, year VARCHAR, winner_and_nominees VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the orignal title for the winner and nominee, Breaking the Waves, in 1996 (11th)?
SELECT original_title FROM table_name_56 WHERE year = "1996 (11th)" AND winner_and_nominees = "breaking the waves"
sql_create_context
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE transfers ( row_id number, subject_id number, had...
SELECT t1.startdate FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = '5% dextrose' AND admissions.subject_id = 25951 AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 's...
mimic_iii
CREATE TABLE table_59783 ( "Place" text, "Player" text, "Country" text, "Score" real, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the to par of Tiger Woods, where his score was less than 67, and he was in t1 place?
SELECT "To par" FROM table_59783 WHERE "Score" < '67' AND "Place" = 't1' AND "Player" = 'tiger woods'
wikisql
CREATE TABLE table_name_62 ( total INTEGER, silver VARCHAR, gold VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest total medals when there were 0 gold medals and 1 silver?
SELECT MAX(total) FROM table_name_62 WHERE silver = 1 AND gold < 0
sql_create_context
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'wbc casts') AND STRFTIME('%y', labevents.charttime) <= '2104')
mimic_iii
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT COUNT(*) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '蒋飞白' AND t_kc22.STA_DATE BETWEEN '2000-04-18' AND '2006-08-04' AND t_kc21.MED_SER_ORG_NO = '4684405' AND t_kc22.MED_INV_ITEM_TYPE = '西药费'
css
CREATE TABLE club ( club_id number, club_name text, region text, start_year number ) CREATE TABLE match_result ( rank number, club_id number, gold number, big_silver number, small_silver number, bronze number, points number ) CREATE TABLE player_coach ( player_id number...
SELECT sponsor_name FROM player WHERE residence = "Brandon" OR residence = "Birtle"
spider
CREATE TABLE table_name_13 ( austria VARCHAR, croatia VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is shown for Austria when Croatia shows Ireland?
SELECT austria FROM table_name_13 WHERE croatia = "ireland"
sql_create_context
CREATE TABLE table_538 ( "Team" text, "Car(s)" text, "#" real, "Driver(s)" text, "Primary Sponsor(s)" text, "Owner(s)" text, "Crew Chief" text, "Rounds" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was crew chief for the team owned...
SELECT "Crew Chief" FROM table_538 WHERE "Owner(s)" = 'Bob Leavine'
wikisql
CREATE TABLE table_32947 ( "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. -- Which away team has a score of 9.12 (66)?
SELECT "Away team" FROM table_32947 WHERE "Away team score" = '9.12 (66)'
wikisql
CREATE TABLE table_29377 ( "Season" real, "Series" text, "Team" text, "Starts" real, "Wins" real, "Podiums" real, "Poles" real, "Fastest Laps" real, "Points" text, "Place" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- name the p...
SELECT "Podiums" FROM table_29377 WHERE "Starts" = '22'
wikisql
CREATE TABLE table_14325808_1 ( area__km²_ VARCHAR, population__2007_estimation_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many places of whatever size have a 2007 population estimation of 7996?
SELECT COUNT(area__km²_) FROM table_14325808_1 WHERE population__2007_estimation_ = 7996
sql_create_context
CREATE TABLE table_1668 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who did...
SELECT "High assists" FROM table_1668 WHERE "High points" = 'Kevin Durant (28)'
wikisql
CREATE TABLE PostHistoryTypes ( 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, Profi...
SELECT DATEADD(month, DATEDIFF(month, 0, CreationDate), 0) AS "month", COUNT(q.Id) AS NumQuests FROM Posts AS q INNER JOIN PostTags AS pt ON q.Id = pt.PostId INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE q.PostTypeId = 1 AND q.CreationDate >= '2016-01-01 00:00:00' GROUP BY DATEDIFF(month, 0, CreationDate), t.TagName OR...
sede
CREATE TABLE table_51642 ( "Year" real, "Franchise" text, "League" text, "Percentage" real, "Finish" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the Finish when NL was the League, the Percentage was under 0.726, the Year was larger than ...
SELECT "Finish" FROM table_51642 WHERE "League" = 'nl' AND "Percentage" < '0.726' AND "Year" > '1897' AND "Franchise" = 'pittsburgh pirates'
wikisql
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, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
SELECT * FROM FlagTypes
sede
CREATE TABLE table_20809 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the production co...
SELECT "Production code" FROM table_20809 WHERE "Written by" = 'Joe Connelly and Bob Mosher' AND "Title" = 'Beaver Gets Adopted'
wikisql
CREATE TABLE table_32602 ( "Year" real, "Sportsperson" text, "Nationality" text, "Team" text, "Competition , federation , or league" text, "Sport" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Post 1994, who are the winners of Sportsperson from...
SELECT "Sportsperson" FROM table_32602 WHERE "Year" > '1994' AND "Competition , federation , or league" = 'national basketball association'
wikisql
CREATE TABLE table_39118 ( "Country" text, "Skip" text, "Third" text, "Second" text, "Lead" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who holds the lead role when Aanders Brorson is third?
SELECT "Lead" FROM table_39118 WHERE "Third" = 'aanders brorson'
wikisql
CREATE TABLE table_60216 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( \u00a3 )" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How much money does the player with a 68-71-68-72=279 score have?
SELECT "Money ( \u00a3 )" FROM table_60216 WHERE "Score" = '68-71-68-72=279'
wikisql
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, ...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures ...
mimic_iii
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "5768" AND lab.flag = "abnormal"
mimicsql_data
CREATE TABLE table_59970 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the away team that tottenham hotspur played?
SELECT "Away team" FROM table_59970 WHERE "Home team" = 'tottenham hotspur'
wikisql
CREATE TABLE table_63782 ( "Rank" text, "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 least bronze when the nation is soviet union and the total is less than 11?
SELECT MIN("Bronze") FROM table_63782 WHERE "Nation" = 'soviet union' AND "Total" < '11'
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 t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE STRFTIME('%y', diagnosis.diagnosistime) <= '2101' GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 4
eicu
CREATE TABLE table_33302 ( "Song" text, "Release date" text, "Release info" text, "Formats" text, "Album" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which song released on heavenly (hvn152)?
SELECT "Song" FROM table_33302 WHERE "Release info" = 'heavenly (hvn152)'
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 qtb.MED_ORG_DEPT_NM, qtb.OUT_DIAG_DIS_NM, AVG(qtb.PERSON_AGE) FROM qtb WHERE qtb.MED_SER_ORG_NO = '0781537' GROUP BY qtb.MED_ORG_DEPT_NM, qtb.OUT_DIAG_DIS_NM UNION SELECT gyb.MED_ORG_DEPT_NM, gyb.OUT_DIAG_DIS_NM, AVG(gyb.PERSON_AGE) FROM gyb WHERE gyb.MED_SER_ORG_NO = '0781537' GROUP BY gyb.MED_ORG_DEPT_NM, gyb....
css
CREATE TABLE table_203_56 ( id number, "star" text, "start\nyear" number, "end\nyear" number, "maximum\nyear" number, "maximum\nmagnitude" number, "distance at\nmaximum (ly)" number, "current\ndistance" number, "current\nmagnitude" number ) -- Using valid SQLite, answer the followi...
SELECT COUNT("star") FROM table_203_56 WHERE "current\nmagnitude" >= 1.0
squall
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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), CO...
SELECT COUNTRY_NAME, SUM(EMPLOYEE_ID) FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID JOIN locations AS T3 ON T2.LOCATION_ID = T3.LOCATION_ID JOIN countries AS T4 ON T3.COUNTRY_ID = T4.COUNTRY_ID GROUP BY COUNTRY_NAME
nvbench
CREATE TABLE affiliated_with ( physician number, department number, primaryaffiliation boolean ) CREATE TABLE physician ( employeeid number, name text, position text, ssn number ) CREATE TABLE medication ( code number, name text, brand text, description text ) CREATE TABLE...
SELECT name FROM department GROUP BY departmentid ORDER BY COUNT(departmentid) DESC LIMIT 1
spider
CREATE TABLE table_name_18 ( years VARCHAR, actor VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What years have claudia ruffo as the actor?
SELECT years FROM table_name_18 WHERE actor = "claudia ruffo"
sql_create_context
CREATE TABLE table_204_630 ( id number, "no" number, "date" text, "race" text, "track" text, "winner" text, "reports" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what race is immediately after the pennsylvania 200 ?
SELECT "race" FROM table_204_630 WHERE id = (SELECT id FROM table_204_630 WHERE "race" = 'pennsylvania 200') + 1
squall
CREATE TABLE table_204_727 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who had the next highest number of gold medals after the unites s...
SELECT "nation" FROM table_204_727 WHERE "gold" < (SELECT "gold" FROM table_204_727 WHERE "nation" = 'united states') ORDER BY "gold" DESC LIMIT 1
squall
CREATE TABLE table_name_13 ( virtual_channel VARCHAR, call_sign VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Call sign of k43hb-ld is what virtual channel?
SELECT virtual_channel FROM table_name_13 WHERE call_sign = "k43hb-ld"
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE\CORONARY ARTERY BYPASS GRAFT /SDA" AND demographic.age < "89"
mimicsql_data
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "WHITE" AND diagnoses.icd9_code = "7847"
mimicsql_data
CREATE TABLE table_dev_16 ( "id" int, "white_blood_cell_count_wbc" int, "autoimmune_disease" bool, "creatinine_clearance_cl" float, "platelet_count" float, "collagen_vascular_disease" bool, "hypertension" bool, "systemic_corticosteroids" bool, "NOUSE" float ) -- Using valid SQLite,...
SELECT * FROM table_dev_16 WHERE white_blood_cell_count_wbc < 3
criteria2sql
CREATE TABLE song ( languages VARCHAR, rating INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average rating of songs for each language?
SELECT AVG(rating), languages FROM song GROUP BY languages
sql_create_context
CREATE TABLE table_name_69 ( icao VARCHAR, iata VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the ICAO for IATA of rgn
SELECT icao FROM table_name_69 WHERE iata = "rgn"
sql_create_context
CREATE TABLE table_17692 ( "Club" text, "Overall Record" text, "Goals For" real, "Goals For Avg." text, "Goals Against" real, "Goals Against Avg." text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the goals for when the club is new england ...
SELECT "Goals For" FROM table_17692 WHERE "Club" = 'New England Revolution'
wikisql
CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDispl...
SELECT Users.Id AS "user_link", COUNT(Posts.Id) AS Answers, CAST(AVG(CAST(Score AS FLOAT)) AS FLOAT(6, 2)) AS "average_answer_score", Users.Reputation FROM Posts INNER JOIN Users ON Users.Id = OwnerUserId WHERE PostTypeId = 2 AND CommunityOwnedDate IS NULL AND ClosedDate IS NULL GROUP BY Users.Id, DisplayName, Users.Re...
sede
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 d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '...
mimic_iii
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 MIN(demographic.age) FROM demographic WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND demographic.days_stay = "9"
mimicsql_data
CREATE TABLE prereq ( course_id varchar(8), prereq_id varchar(8) ) 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 section ( course_id varchar(8), sec_id varchar(8)...
SELECT ID, salary FROM instructor ORDER BY salary
nvbench
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE outputevents ( row_id number, subject_id number, ...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'megestrol acetate' AND STRFTIME('%y', prescriptions.startdate) <=...
mimic_iii
CREATE TABLE table_name_57 ( points_1 INTEGER, goal_difference VARCHAR, drawn VARCHAR, goals_against VARCHAR, lost VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the most points 1 when the goals against are fewer than 97, lost less than 2...
SELECT MAX(points_1) FROM table_name_57 WHERE goals_against < 97 AND lost < 22 AND drawn = 9 AND goal_difference = "+28"
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code tex...
SELECT (SELECT vitalperiodic.heartrate FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-72915') AND NOT patient.unitdischargetime IS ...
eicu
CREATE TABLE table_name_52 ( song VARCHAR, draw VARCHAR, points VARCHAR, place VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Song has Points smaller than 53, and a Place larger than 8, and a Draw larger than 1?
SELECT song FROM table_name_52 WHERE points < 53 AND place > 8 AND draw > 1
sql_create_context
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_co...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'colonoscopy') AND DATETIME(procedures_icd.charttime,...
mimic_iii
CREATE TABLE table_name_52 ( losses VARCHAR, goals_for VARCHAR, games_played VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many losses did the team with 22 goals for andmore than 8 games played have?
SELECT COUNT(losses) FROM table_name_52 WHERE goals_for = 22 AND games_played > 8
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2049" AND procedures.icd9_code = "9962"
mimicsql_data
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2166" AND lab.label = "Absolute CD4 Count"
mimicsql_data
CREATE TABLE table_57360 ( "Player" text, "Car." real, "Yards" text, "Avg." text, "TD's" real, "Long" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the sum of TD's for 4 avg.
SELECT SUM("TD's") FROM table_57360 WHERE "Avg." = '4'
wikisql