instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
SELECT All_Home, AVG(School_ID) FROM basketball_match GROUP BY All_Home ORDER BY AVG(School_ID)
nvbench
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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2104" AND prescriptions.drug_type = "BASE"
mimicsql_data
CREATE TABLE table_731 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the district that Otto Passman is the incumbent of?
SELECT "District" FROM table_731 WHERE "Incumbent" = 'Otto Passman'
wikisql
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, ...
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 = 'reticulocyte count, automated')) AND DATETIME(cost.chargetime, 'start of year') = DATETIME(CURRENT_TI...
mimic_iii
CREATE TABLE table_27293285_4 ( won VARCHAR, points_against VARCHAR, played VARCHAR, lost VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the won for played being 22 and points against 511 and lost being 15
SELECT won FROM table_27293285_4 WHERE played = "22" AND lost = "15" AND points_against = "511"
sql_create_context
CREATE TABLE table_name_1 ( number_of_jews__wjc_ INTEGER, rank___wjc__ VARCHAR, rank__arda_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the highest number of WJC Jews that had a WJC rank of 6 and a ARDA rank of more than 8?
SELECT MAX(number_of_jews__wjc_) FROM table_name_1 WHERE rank___wjc__ = 6 AND rank__arda_ > 8
sql_create_context
CREATE TABLE table_name_52 ( source VARCHAR, internet_explorer VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which source date has an Internet Explorer usage of 60.2%?
SELECT source FROM table_name_52 WHERE internet_explorer = "60.2%"
sql_create_context
CREATE TABLE table_37298 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHich Score has a Record of 31 28 3?
SELECT "Score" FROM table_37298 WHERE "Record" = '31–28–3'
wikisql
CREATE TABLE table_name_39 ( division_record VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Senators' division record?
SELECT division_record FROM table_name_39 WHERE team = "senators"
sql_create_context
CREATE TABLE table_202_68 ( id number, "value" text, "diameter" text, "composition" text, "1979-1989\nobverse" text, "1979-1989\nreverse" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is on the obverse side of each coin ?
SELECT DISTINCT "1979-1989\nobverse" FROM table_202_68
squall
CREATE TABLE table_53226 ( "Serial" text, "Airborne Unit" text, "Troop carrier Group" text, "# of C-47s" real, "UK Base" text, "Drop Zone" text, "Drop Zone Time" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which UK base has 441st tcg Troo...
SELECT "UK Base" FROM table_53226 WHERE "Troop carrier Group" = '441st tcg' AND "Serial" = '14'
wikisql
CREATE TABLE table_67827 ( "Year" text, "Start" text, "Qual" text, "Rank" text, "Finish" text, "Laps" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the qual for year of 1960
SELECT "Qual" FROM table_67827 WHERE "Year" = '1960'
wikisql
CREATE TABLE Participates_in ( stuid INTEGER, actid INTEGER ) CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ) CREATE TABLE Activity ( actid INTEGER, acti...
SELECT Rank, COUNT(*) FROM Faculty GROUP BY Rank
nvbench
CREATE TABLE table_62735 ( "Name" text, "Height" text, "Weight" text, "Spike" text, "2008 club" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the 2008 club Apure?
SELECT "Name" FROM table_62735 WHERE "2008 club" = 'apure'
wikisql
CREATE TABLE table_29054902_1 ( production_code VARCHAR, us_viewers__million_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the production code of the episode that was watched by 3.81 million U.S. viewers?
SELECT production_code FROM table_29054902_1 WHERE us_viewers__million_ = "3.81"
sql_create_context
CREATE TABLE table_680 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Results" text, "Candidatess" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result when incumbent gil gutknecht ran?
SELECT "Results" FROM table_680 WHERE "Incumbent" = 'Gil Gutknecht'
wikisql
CREATE TABLE table_50964 ( "Title" text, "Parent magazine" text, "Magazine type" text, "Frequency" text, "Magazine run" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What titles come out monthly?
SELECT "Title" FROM table_50964 WHERE "Frequency" = 'monthly'
wikisql
CREATE TABLE table_71154 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Pts." text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What ist he entrant later than 1963 with an eagle MK1 chassis?
SELECT "Entrant" FROM table_71154 WHERE "Year" > '1963' AND "Chassis" = 'eagle mk1'
wikisql
CREATE TABLE table_54258 ( "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 score of the game on 27 January 1996?
SELECT "Score" FROM table_54258 WHERE "Date" = '27 january 1996'
wikisql
CREATE TABLE table_train_143 ( "id" int, "gender" string, "systolic_blood_pressure_sbp" int, "agitation" bool, "npi" int, "aggression_domain" bool, "delusions_hallucinations" bool, "pulse_rate" int, "fridericia_corrected_qt_interval_qtcf" int, "diastolic_blood_pressure_dbp" int, ...
SELECT * FROM table_train_143 WHERE (gender = 'male' AND fridericia_corrected_qt_interval_qtcf > 450) OR (gender = 'female' AND fridericia_corrected_qt_interval_qtcf > 470)
criteria2sql
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE wdmzjzjlb.JZZDSM = '口齿病(龋齿病)' AND jyjgzbb.JCZBDM = '559847' UNION SELECT jyjgzbb.CKZFW...
css
CREATE TABLE table_16494599_2 ( player VARCHAR, school_club_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many players went to depaul?
SELECT COUNT(player) FROM table_16494599_2 WHERE school_club_team = "DePaul"
sql_create_context
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
SELECT (SELECT QTY * UNIVALENT FROM t_kc22 WHERE MED_EXP_DET_ID = '71084691252') = (SELECT AMOUNT FROM t_kc22 WHERE MED_EXP_DET_ID = '71084691252')
css
CREATE TABLE table_name_9 ( time VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the time for buffalo bills
SELECT time FROM table_name_9 WHERE opponent = "buffalo bills"
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "DOBUTamine"
mimicsql_data
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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decima...
SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY HIRE_DATE
nvbench
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
SELECT wdmzjzjlb.MZZYZDZZBM FROM wdmzjzjlb WHERE wdmzjzjlb.JZLSH = '33429029356' UNION SELECT bdmzjzjlb.MZZYZDZZBM FROM bdmzjzjlb WHERE bdmzjzjlb.JZLSH = '33429029356'
css
CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE time_zone ( time_zone_code t...
SELECT DISTINCT flight_id FROM flight WHERE (airline_code = 'DL')
atis
CREATE TABLE table_name_46 ( name VARCHAR, best VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the name with best of 58.403
SELECT name FROM table_name_46 WHERE best = "58.403"
sql_create_context
CREATE TABLE table_name_99 ( played VARCHAR, losing_bonus VARCHAR, points_for VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the played with losing bonus of 2 and points for of 706
SELECT played FROM table_name_99 WHERE losing_bonus = "2" AND points_for = "706"
sql_create_context
CREATE TABLE table_66944 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which team of the team 1 column, has a 2nd leg of 1-0?
SELECT "Team 1" FROM table_66944 WHERE "2nd leg" = '1-0'
wikisql
CREATE TABLE table_51374 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the record on April 1?
SELECT "Record" FROM table_51374 WHERE "Date" = 'april 1'
wikisql
CREATE TABLE table_6968 ( "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. -- Which Partner is on 22 april 2002?
SELECT "Partner" FROM table_6968 WHERE "Date" = '22 april 2002'
wikisql
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "0" AND prescriptions.route = "NEB"
mimicsql_data
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2158" AND lab.label = "Thyroxine (T4)"
mimicsql_data
CREATE TABLE table_name_68 ( tournament VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT IS THE 2009 PERFORMANCE FOR TOURNAMENTS PLAYED?
SELECT 2009 FROM table_name_68 WHERE tournament = "tournaments played"
sql_create_context
CREATE TABLE table_58229 ( "Production no." real, "Episode no." real, "Original Airdate" text, "Episode Title" text, "Host" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the title of the episode that originally aired on March 31, 2008?
SELECT "Episode Title" FROM table_58229 WHERE "Original Airdate" = 'march 31, 2008'
wikisql
CREATE TABLE table_40201 ( "Date" text, "Tournament" text, "Surface" text, "Opponent in the final" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For the tournament played on September 25, 1995, who was the Finals opponent?
SELECT "Opponent in the final" FROM table_40201 WHERE "Date" = 'september 25, 1995'
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 COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT microbiologyevents.hadm_id FROM microbiologyevents WHERE microbiologyevents.spec_type_desc = 'abscess' AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year'))
mimic_iii
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, Acce...
WITH posts_WITH_java_tags AS (SELECT PostId FROM PostTags AS pt LEFT JOIN Tags AS t ON pt.TagId = t.Id WHERE LOWER(t.TagName) = 'java') SELECT u.Id AS "user_link", u.Reputation, COUNT(*) AS number_of_answers FROM Posts AS p INNER JOIN posts_WITH_java_tags AS pt ON pt.PostId = p.Id INNER JOIN Posts AS a ON a.ParentId = ...
sede
CREATE TABLE table_76496 ( "Game" real, "Date" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total game number with athlone town as the opponent?
SELECT COUNT("Game") FROM table_76496 WHERE "Opponent" = 'athlone town'
wikisql
CREATE TABLE table_name_3 ( away_team VARCHAR, home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Away Team, when Home Team is 'Swindon Town'?
SELECT away_team FROM table_name_3 WHERE home_team = "swindon town"
sql_create_context
CREATE TABLE table_31471 ( "Event" real, "Circuit" text, "GT3 Pro Cup Winner" text, "GT3 Pro / Am Cup Winner" text, "GT3 Citation Cup Winner" text, "GT4 Cup Winner" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who are the gt3 pro / am cup winn...
SELECT "GT3 Pro / Am Cup Winner" FROM table_31471 WHERE "GT3 Pro Cup Winner" = 'No. 1 Vita4One'
wikisql
CREATE TABLE table_70473 ( "Rank" real, "Gymnast" text, "Difficulty score" text, "Routine score" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total with lower than rank 8, and higher than 27.6 score and 13.8 difficulty?
SELECT MIN("Total") FROM table_70473 WHERE "Rank" > '8' AND "Routine score" > '27.6' AND "Difficulty score" = '13.8'
wikisql
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) 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 (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.diagnosis = "ABDOMINAL PAIN"
mimicsql_data
CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE...
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, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND date_day.day_number = 16 AND date_day.month_number = 6 AND d...
atis
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9cod...
SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-36245')) AND intakeoutput.cellpath LIKE '%ou...
eicu
CREATE TABLE table_10979230_4 ( oricon VARCHAR, japanese_title VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What rank is on the Japanese singles chart?
SELECT COUNT(oricon) FROM table_10979230_4 WHERE japanese_title = "愛のバカ"
sql_create_context
CREATE TABLE table_11803 ( "Week" text, "Date" text, "Opponent" text, "Result" text, "Kickoff [a ]" text, "Game site" text, "Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the attandance figure on Octob...
SELECT "Attendance" FROM table_11803 WHERE "Date" = 'october 7, 1990'
wikisql
CREATE TABLE table_name_80 ( utah VARCHAR, texas VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the value for utah when texas is humphrey?
SELECT utah FROM table_name_80 WHERE texas = "humphrey"
sql_create_context
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 'http://aviation.stackexchange.com/' + LOWER(SUBSTRING(pt.Name, 1, 1)) + '/' + CAST(p.Id AS TEXT(255)) AS ID, pt.Name AS PostType, p.CreationDate, u.DisplayName AS PostWrittenBy, p.Title, p.Body FROM Posts AS p JOIN PostTypes AS pt ON p.PostTypeId = pt.Id JOIN Users AS u ON p.OwnerUserId = u.Id WHERE p.Body LIKE...
sede
CREATE TABLE table_203_397 ( id number, "series" text, "launch date" text, "finale date" text, "days" number, "housemates" number, "winner" text, "main presenter" text, "grand prize" text, "liveshow\naudience\nmillions" number ) -- Using valid SQLite, answer the following quest...
SELECT MAX("days") FROM table_203_397
squall
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 * FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '3266292' AND t_kc21.IN_HOSP_DATE BETWEEN '2007-09-14' AND '2018-06-15' EXCEPT SELECT * FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '3266292' AND t_kc21.IN_HOSP_DATE BETWEEN '2007-09-14' AND '2018-06-15' AND t_kc21.MED_ORG_DEPT_NM = '儿童口腔科'
css
CREATE TABLE table_34531 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the date for the game played on week 8, with an attendance of more than 35,000?
SELECT "Date" FROM table_34531 WHERE "Attendance" > '35,000' AND "Week" = '8'
wikisql
CREATE TABLE party ( Party_ID int, Minister text, Took_office text, Left_office text, Region_ID int, Party_name text ) CREATE TABLE region ( Region_ID int, Region_name text, Date text, Label text, Format text, Catalogue text ) CREATE TABLE member ( Member_ID int, ...
SELECT Minister, COUNT(Minister) FROM party WHERE Party_name <> 'Progress Party' GROUP BY Minister ORDER BY COUNT(Minister) DESC
nvbench
CREATE TABLE table_11891 ( "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 team had an away score of 15.14 (104)?
SELECT "Home team" FROM table_11891 WHERE "Away team score" = '15.14 (104)'
wikisql
CREATE TABLE table_57268 ( "Year" real, "Network" text, "Lap-by-lap" text, "s Color commentator" text, "Pre-Race Host" text, "Ratings" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the Pre-Race Host when Mike Joy was the Lap-by-lap in t...
SELECT "Pre-Race Host" FROM table_57268 WHERE "Lap-by-lap" = 'mike joy' AND "Year" = '2005'
wikisql
CREATE TABLE table_66835 ( "Year" text, "Start" text, "Qual" text, "Rank" text, "Finish" text, "Laps" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the rank when there are more than 107 laps and the qual is 137.825?
SELECT "Rank" FROM table_66835 WHERE "Laps" > '107' AND "Qual" = '137.825'
wikisql
CREATE TABLE table_15366849_1 ( zone INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the biggest zone?
SELECT MAX(zone) FROM table_15366849_1
sql_create_context
CREATE TABLE table_65218 ( "School" text, "Location" text, "Mascot" text, "County" text, "Year Joined" real, "Year Left" real, "Conference Joined" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the highest Year Left that's got a Confe...
SELECT MAX("Year Left") FROM table_65218 WHERE "Conference Joined" = 'sagamore' AND "Year Joined" > '1942'
wikisql
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE lab ( labid number, pa...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'lab' AND cost.eventid IN (SELECT lab.labid FROM lab WHERE lab.labname = 'calcium')
eicu
CREATE TABLE table_11900773_6 ( first_day_cover_cancellation VARCHAR, date_of_issue VARCHAR, theme VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where is the first day cover cancellation for the 3 April 2008 IIHF World Championships, Quebec City stamp?
SELECT first_day_cover_cancellation FROM table_11900773_6 WHERE date_of_issue = "3 April 2008" AND theme = "IIHF World Championships, Quebec City"
sql_create_context
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Mupirocin Cream 2%"
mimicsql_data
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT SUM(t_kc24.PER_ACC_PAY) FROM t_kc24 WHERE t_kc24.t_kc21_PERSON_NM = '周才英' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2009-03-14' AND '2019-09-13'
css
CREATE TABLE table_name_42 ( competition VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which competition was on August 11, 1996?
SELECT competition FROM table_name_42 WHERE date = "august 11, 1996"
sql_create_context
CREATE TABLE table_name_24 ( antonio_thomas VARCHAR, hikaru_sato VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the antonio thomas for Hikaru Sato of tanaka (8:09)
SELECT antonio_thomas FROM table_name_24 WHERE hikaru_sato = "tanaka (8:09)"
sql_create_context
CREATE TABLE restaurant ( id int, name varchar, food_type varchar, city_name varchar, rating "decimal ) CREATE TABLE geographic ( city_name varchar, county varchar, region varchar ) CREATE TABLE location ( restaurant_id int, house_number int, street_name varchar, city_n...
SELECT location.house_number, restaurant.name FROM location, restaurant WHERE location.city_name = 'mountain view' AND restaurant.food_type = 'arabic' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5
restaurants
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.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 40 AND 49) AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-1 year') GR...
eicu
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, ...
SELECT CommentCount, ClosedDate, LastActivityDate FROM Posts LIMIT 10
sede
CREATE TABLE table_2409041_4 ( original_air_date VARCHAR, no_in_season VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the number of airdates for 14
SELECT COUNT(original_air_date) FROM table_2409041_4 WHERE no_in_season = 14
sql_create_context
CREATE TABLE table_name_88 ( silver INTEGER, rank VARCHAR, gold VARCHAR, total VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of sliver medals when there were 2 gold medals, less than 15 total medals, and the rank is greater than 5?
SELECT SUM(silver) FROM table_name_88 WHERE gold = 2 AND total < 15 AND rank > 5
sql_create_context
CREATE TABLE table_34847 ( "Tournament" text, "1981" text, "1982" text, "1983" text, "1984" text, "1985" text, "1986" text, "1987" text, "1988" text, "1989" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which 1988 has a 1985 of ...
SELECT "1988" FROM table_34847 WHERE "1985" = '2r'
wikisql
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE prescriptions ( row_id number, subject_id number, h...
SELECT COUNT(*) > 0 FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19096)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [syst...
mimic_iii
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 WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.diagnosis = "HYPERGLYCEMIA;HYPONATREMIA"
mimicsql_data
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) ...
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'administration of electrolytes - phosphate' AND STRFTIME('%y', treatment.treatmenttime) <= '2104') AS t1 JOI...
eicu
CREATE TABLE table_72371 ( "District" text, "Incumbent" text, "Party" text, "Elected" real, "Status" text, "Opponent" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What districts does incumbent Curt Weldon hold?
SELECT "District" FROM table_72371 WHERE "Incumbent" = 'Curt Weldon'
wikisql
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
SELECT School_ID, All_Games_Percent FROM basketball_match GROUP BY All_Neutral
nvbench
CREATE TABLE table_9781 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Attendance after Week 8 with a Result of W 42 0?
SELECT MAX("Attendance") FROM table_9781 WHERE "Week" > '8' AND "Result" = 'w 42–0'
wikisql
CREATE TABLE table_65356 ( "Pick" real, "Player" text, "Country of origin*" text, "PBA team" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the pba team for the player who went to santo tomas college?
SELECT "PBA team" FROM table_65356 WHERE "College" = 'santo tomas'
wikisql
CREATE TABLE table_1342359_15 ( first_elected VARCHAR, district VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many first elected with district is kansas 3
SELECT COUNT(first_elected) FROM table_1342359_15 WHERE district = "Kansas 3"
sql_create_context
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, ...
SELECT COUNT(*) > 0 FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 22782)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'l groin'...
mimic_iii
CREATE TABLE fzzmzjzjlb ( 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, MZZYZD...
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE zzmzjzjlb.JZZDBM = 'Z83.066' AND jyjgzbb.JCZBDM = '549027' UNION SELECT jyjgzbb.CKZFWX...
css
CREATE TABLE table_30030477_1 ( title VARCHAR, original_air_date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many titles are there with the original air date of august3,2010?
SELECT COUNT(title) FROM table_30030477_1 WHERE original_air_date = "August3,2010"
sql_create_context
CREATE TABLE table_name_15 ( athlete VARCHAR, time___sec__ VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which athlete is ranked less than 5 with time over 11.22?
SELECT athlete FROM table_name_15 WHERE time___sec__ > 11.22 AND rank < 5
sql_create_context
CREATE TABLE table_24399615_3 ( cable_rank VARCHAR, bbc_three_weekly_ranking VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the cable rank for bbc three weekly ranking of n/a?
SELECT cable_rank FROM table_24399615_3 WHERE bbc_three_weekly_ranking = "N/A"
sql_create_context
CREATE TABLE table_name_73 ( authors VARCHAR, location VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which author is located in Mexico?
SELECT authors FROM table_name_73 WHERE location = "mexico"
sql_create_context
CREATE TABLE table_name_91 ( team VARCHAR, location VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which team is located in Lida?
SELECT team FROM table_name_91 WHERE location = "lida"
sql_create_context
CREATE TABLE table_41287 ( "Team" text, "City" text, "State" text, "Home venue" text, "Capacity" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the city with a capacity of 41,311?
SELECT "City" FROM table_41287 WHERE "Capacity" = '41,311'
wikisql
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttim...
SELECT microbiologyevents.org_name FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23070) AND microbiologyevents.spec_type_desc = 'pleural fluid' AND NOT microbiologyevents.org_name IS NULL AND DATETIME(microbiologyevents.charttime) >=...
mimic_iii
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) 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 ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE procedures.icd9_code = "5771" AND prescriptions.drug_type = "ADDITIVE"
mimicsql_data
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
SELECT ACC_Percent, All_Games_Percent FROM basketball_match GROUP BY All_Neutral
nvbench
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 admissions.admittime FROM admissions WHERE admissions.subject_id = 81783 AND admissions.admission_location = 'clinic referral/premature' ORDER BY admissions.admittime LIMIT 1
mimic_iii
CREATE TABLE table_68991 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the most points when the chassis was Jaguar R3 later than 2002?
SELECT MAX("Points") FROM table_68991 WHERE "Chassis" = 'jaguar r3' AND "Year" > '2002'
wikisql
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) 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...
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 = 'DALLAS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MILWAU...
atis
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
SELECT CHA_ITEM_LEV FROM t_kc22 WHERE MED_CLINIC_ID = '77570477407' AND SOC_SRT_DIRE_NM = '汉防己甲素片(薄膜衣)'
css
CREATE TABLE table_73403 ( "District" text, "Vacator" text, "Reason for change" text, "Successor" text, "Date successor seated" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the reason for change when maryland 6th is the district?
SELECT "Reason for change" FROM table_73403 WHERE "District" = 'Maryland 6th'
wikisql
CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_season int, Title text, Directed_by text, Original_air_date text, Production_code text ) CREATE TABLE cinema ( Cinema_ID int, Name text, Openning_year int, Capacity int, Location text ) CREATE TABLE schedule...
SELECT Openning_year, SUM(Capacity) FROM cinema GROUP BY Openning_year ORDER BY Openning_year
nvbench
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Unspecified hereditary and idiopathic peripheral neuropathy" AND prescriptions.drug_type = ...
mimicsql_data
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 AVG(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-13677')) AND intakeoutput.celllabel = 'outpu...
eicu
CREATE TABLE table_41068 ( "Television service" text, "Country" text, "Language" text, "Content" text, "HDTV" text, "Package/Option" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Television Service, when HDTV is No, and when Language is...
SELECT "Television service" FROM table_41068 WHERE "HDTV" = 'no' AND "Language" = 'italian'
wikisql