instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_name_67 ( premier VARCHAR, second VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of Premier, when Second is '55'?
SELECT COUNT(premier) FROM table_name_67 WHERE second = 55
sql_create_context
CREATE TABLE Addresses ( Address_ID INTEGER, address_details VARCHAR(255) ) CREATE TABLE Assets_in_Events ( Asset_ID INTEGER, Event_ID INTEGER ) CREATE TABLE Parties_in_Events ( Party_ID INTEGER, Event_ID INTEGER, Role_Code CHAR(15) ) CREATE TABLE Finances ( Finance_ID INTEGER, Ot...
SELECT Product_Name, COUNT(*) FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name ORDER BY COUNT(*) DESC
nvbench
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "ASIAN" AND prescriptions.drug_type = "ADDITIVE"
mimicsql_data
CREATE TABLE table_1691800_2 ( income_class VARCHAR, area__km²_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the income class for area 75?
SELECT income_class FROM table_1691800_2 WHERE area__km²_ = 75
sql_create_context
CREATE TABLE table_name_41 ( ties VARCHAR, season VARCHAR, losses VARCHAR, wins VARCHAR, games VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many Ties have Wins smaller than 1, and Games of 6, and Losses of 6, and a Season larger than 1941?
SELECT COUNT(ties) FROM table_name_41 WHERE wins < 1 AND games = 6 AND losses = 6 AND season > 1941
sql_create_context
CREATE TABLE table_name_56 ( year INTEGER, role VARCHAR, director VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year was the role nan taylor, alias of nan ellis, aka mrs. andrews and directed by William keighley?
SELECT SUM(year) FROM table_name_56 WHERE role = "nan taylor, alias of nan ellis, aka mrs. andrews" AND director = "william keighley"
sql_create_context
CREATE TABLE location ( restaurant_id int, house_number int, street_name varchar, city_name varchar ) CREATE TABLE restaurant ( id int, name varchar, food_type varchar, city_name varchar, rating "decimal ) CREATE TABLE geographic ( city_name varchar, county varchar, reg...
SELECT location.house_number, restaurant.name FROM geographic, location, restaurant WHERE geographic.region = 'yosemite and mono lake area' AND restaurant.city_name = geographic.city_name AND restaurant.food_type = 'french' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5
restaurants
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 COUNT(*) FROM wdmzjzjlb WHERE wdmzjzjlb.JZKSMC = '创伤骨科' AND wdmzjzjlb.RYDJSJ BETWEEN '2012-09-21' AND '2017-09-17' UNION SELECT COUNT(*) FROM bdmzjzjlb WHERE bdmzjzjlb.JZKSMC = '创伤骨科' AND bdmzjzjlb.RYDJSJ BETWEEN '2012-09-21' AND '2017-09-17'
css
CREATE TABLE table_2640 ( "Party Name" text, "States contested" real, "Seats contested" real, "Seats won" real, "No. of Votes" real, "% of Votes" text, "% in Seats contested" text, "Forfeited in seats" real ) -- Using valid SQLite, answer the following questions for the tables provided...
SELECT MIN("States contested") FROM table_2640 WHERE "Party Name" = 'Apna Dal'
wikisql
CREATE TABLE table_name_71 ( date VARCHAR, result VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was the result l 14 24?
SELECT date FROM table_name_71 WHERE result = "l 14–24"
sql_create_context
CREATE TABLE table_52069 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the lowest Grid for engine and driver of emerson fittipaldi with more laps than 70
SELECT MIN("Grid") FROM table_52069 WHERE "Time/Retired" = 'engine' AND "Driver" = 'emerson fittipaldi' AND "Laps" > '70'
wikisql
CREATE TABLE table_26996293_7 ( pick__number VARCHAR, cfl_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the pick # of cfl team bc lions (7)
SELECT pick__number FROM table_26996293_7 WHERE cfl_team = "BC Lions (7)"
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CRE...
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-99708')) AND medication.drugname = 'lisinopril 10 mg po tabs' AND STRF...
eicu
CREATE TABLE table_58574 ( "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. -- Which ...
SELECT "Game" FROM table_58574 WHERE "Team" = 'chicago'
wikisql
CREATE TABLE table_203_127 ( id number, "#" number, "date" text, "opponent" text, "score" text, "win" text, "loss" text, "save" text, "attendance" number, "record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- games above 30,000...
SELECT COUNT(*) FROM table_203_127 WHERE "attendance" > 30000
squall
CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT ) CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT ) CREATE TABLE weather ( date TEXT, ...
SELECT mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3
nvbench
CREATE TABLE table_name_43 ( builder VARCHAR, pennant_number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the builder of Pennant d03?
SELECT builder FROM table_name_43 WHERE pennant_number = "d03"
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 lab ( subject_id text, hadm_id text, ...
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 = "30390" AND lab."CATEGORY" = "Blood Gas"
mimicsql_data
CREATE TABLE table_53839 ( "Year" real, "Class" text, "Tyres" text, "Team" text, "Co-Drivers" text, "Laps" real, "Pos." text, "Class Pos." text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which tyre was before 1995 with 142 laps?
SELECT "Tyres" FROM table_53839 WHERE "Year" < '1995' AND "Laps" = '142'
wikisql
CREATE TABLE table_34260 ( "Rank" real, "Player" text, "Country" text, "Earnings ( $ )" real, "Wins" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the lowest wins for Australia?
SELECT MIN("Wins") FROM table_34260 WHERE "Country" = 'australia'
wikisql
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 jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb 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 AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jyb...
css
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 MIN(demographic.age) FROM demographic WHERE demographic.days_stay = "20" AND demographic.dod_year < "2164.0"
mimicsql_data
CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city var...
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (area.area LIKE '%Intermediate Quechua ,%' OR course.description LIKE '%Intermediate Quechua ,%' OR course.name LI...
advising
CREATE TABLE table_1341973_6 ( result VARCHAR, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result of the election of the incumbent clyde doyle?
SELECT result FROM table_1341973_6 WHERE incumbent = "Clyde Doyle"
sql_create_context
CREATE TABLE table_203_805 ( id number, "year" number, "player" text, "position" text, "high school" text, "college" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which college was the most attended by players ?
SELECT "college" FROM table_203_805 GROUP BY "college" ORDER BY COUNT("player") DESC LIMIT 1
squall
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 jyjgzbb.YQBH, jyjgzbb.YQMC FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND 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 jybg...
css
CREATE TABLE table_name_63 ( venue VARCHAR, notes VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What venue featured a notes of 2:38:44?
SELECT venue FROM table_name_63 WHERE notes = "2:38:44"
sql_create_context
CREATE TABLE publication ( Publisher VARCHAR, Price VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- List the publisher of the publication with the highest price.
SELECT Publisher FROM publication ORDER BY Price DESC LIMIT 1
sql_create_context
CREATE TABLE table_41598 ( "Rank" real, "Name" text, "Years" text, "Matches" real, "Goals" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the total number of matches for Nat Lofthouse, ranking higher than 7?
SELECT COUNT("Matches") FROM table_41598 WHERE "Name" = 'nat lofthouse' AND "Rank" > '7'
wikisql
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,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 varc...
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY JOB_ID
nvbench
CREATE TABLE table_53260 ( "Rank" real, "Previous Rank" text, "Name" text, "Nationality" text, "Team" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- I want to know the sum of points with a previous rank of 3
SELECT SUM("Points") FROM table_53260 WHERE "Previous Rank" = '3'
wikisql
CREATE TABLE table_name_92 ( villages INTEGER, hanzi VARCHAR, population VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which town has the most villages with the hanzi and a population larger than 24,802?
SELECT MAX(villages) FROM table_name_92 WHERE hanzi = "南流乡" AND population > 24 OFFSET 802
sql_create_context
CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate real ) CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight re...
SELECT Sex, SUM(Weight) FROM people GROUP BY Sex ORDER BY Sex
nvbench
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) 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 d_icd_procedures ( ...
SELECT COUNT(DISTINCT admissions.hadm_id) FROM admissions WHERE admissions.subject_id = 95057 AND STRFTIME('%y', admissions.admittime) >= '2105'
mimic_iii
CREATE TABLE table_56734 ( "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 ha...
SELECT "High rebounds" FROM table_56734 WHERE "Date" = 'february 24'
wikisql
CREATE TABLE txmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZ...
SELECT (SELECT COUNT(*) FROM hz_info JOIN txmzjzjlb ON hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX WHERE hz_info.RYBH = '36091672' AND txmzjzjlb.JZKSRQ BETWEEN '2002-02-09' AND '2005-03-12' UNION SELECT COUNT(*) FROM hz_info JOIN ftxmzjzjlb ON hz_info.YLJGDM = ftxmzjz...
css
CREATE TABLE table_28245 ( "Metropolitan ring" text, "Localities" real, "Total" real, "Jews and others 1" real, "Thereof: Jews" real, "Arabs" real, "Population density (per km\u00b2)" text, "Annual Population growth rate" text ) -- Using valid SQLite, answer the following questions for...
SELECT COUNT("Localities") FROM table_28245 WHERE "Population density (per km\u00b2)" = '2.5'
wikisql
CREATE TABLE table_name_59 ( drawn INTEGER, lost VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many total drawn has less than 4 lost and 8 points?
SELECT SUM(drawn) FROM table_name_59 WHERE lost < 4 AND points = 8
sql_create_context
CREATE TABLE table_21601 ( "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. -- What g...
SELECT COUNT("Game") FROM table_21601 WHERE "Record" = '2-3'
wikisql
CREATE TABLE table_3423 ( "Player" text, "G" real, "Solo TK" real, "Asst. TK" real, "Total TK" real, "Sack" text, "YdL" real, "INT" real, "Yards" real, "ForFum" real, "FumRec" real, "TD" real ) -- Using valid SQLite, answer the following questions for the tables provide...
SELECT "FumRec" FROM table_3423 WHERE "Player" = 'Reed Doughty'
wikisql
CREATE TABLE table_56659 ( "Tournament" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text ) -- Using valid SQLite, answer the following questions for the tables provided ab...
SELECT "Tournament" FROM table_56659 WHERE "2009" = '11'
wikisql
CREATE TABLE Grants ( grant_id INTEGER, organisation_id INTEGER, grant_amount DECIMAL(19,4), grant_start_date DATETIME, grant_end_date DATETIME, other_details VARCHAR(255) ) CREATE TABLE Staff_Roles ( role_code VARCHAR(10), role_description VARCHAR(255) ) CREATE TABLE Organisations ( ...
SELECT date_to, COUNT(date_to) FROM Project_Staff
nvbench
CREATE TABLE table_12043148_2 ( premier_two VARCHAR, gloucestershire VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who many times is gloucestershire is painswick?
SELECT COUNT(premier_two) FROM table_12043148_2 WHERE gloucestershire = "Painswick"
sql_create_context
CREATE TABLE table_name_30 ( 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 'Boston United'?
SELECT away_team FROM table_name_30 WHERE home_team = "boston united"
sql_create_context
CREATE TABLE table_name_7 ( construct__tion_no INTEGER, wheel_arrange__ment VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many constructions has a Wheel arrange- ment of 4-4-0?
SELECT SUM(construct__tion_no) FROM table_name_7 WHERE wheel_arrange__ment = "4-4-0"
sql_create_context
CREATE TABLE table_name_25 ( left_office VARCHAR, took_office VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Left Office, when Took Office is 1998?
SELECT left_office FROM table_name_25 WHERE took_office = "1998"
sql_create_context
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 MIN(MED_AMOUT), MAX(MED_AMOUT) FROM t_kc24 WHERE MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc21 WHERE MED_SER_ORG_NO = '9572624' AND OUT_DIAG_DIS_NM = '牙齿楔状缺损')
css
CREATE TABLE table_name_34 ( average VARCHAR, balls_faced VARCHAR, innings VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of averages having a balls faced over 297 and more than 7 innings?
SELECT COUNT(average) FROM table_name_34 WHERE balls_faced > 297 AND innings > 7
sql_create_context
CREATE TABLE Movie ( mID int, title text, year int, director text ) CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) CREATE TABLE Reviewer ( rID int, name text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show ...
SELECT title, MIN(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY title
nvbench
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid...
SELECT COUNT(*) FROM treatment WHERE treatment.treatmentname = 'fasciotomy' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
eicu
CREATE TABLE table_61314 ( "Place" text, "Player" text, "Country" text, "Score" real, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was Adam Scott's total score when playing in Australia with a to par of e?
SELECT SUM("Score") FROM table_61314 WHERE "Country" = 'australia' AND "To par" = 'e' AND "Player" = 'adam scott'
wikisql
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 PostId, RelatedPostId FROM PostLinks WHERE LinkTypeId = 1 ORDER BY PostId DESC
sede
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT gwyjzb.MED_ORG_DEPT_NM, gwyjzb.IN_DIAG_DIS_NM, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '5826228' GROUP BY gwyjzb.MED_ORG_DEPT_NM, gwyjzb.IN_DIAG_DIS_NM UNION SELECT fgwyjzb.MED_ORG_DEPT_NM, fgwyjzb.IN_DIAG_DIS_NM, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '58262...
css
CREATE TABLE lives_in ( stuid number, dormid number, room_number number ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE dorm_amenity ( amenid number, amenity_name text )...
SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' ORDER BY T3.amenity_name
spider
CREATE TABLE table_203_531 ( id number, "date" text, "tournament" text, "location" text, "winner" text, "score" text, "1st prize ($)" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which pga tour event gave out the least prize money to its...
SELECT "tournament" FROM table_203_531 ORDER BY "1st prize ($)" LIMIT 1
squall
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT COUNT(*) FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_ID = '10110310' AND t_kc22.STA_DATE BETWEEN '2004-07-21' AND '2008-06-22' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC L...
css
CREATE TABLE table_204_17 ( id number, "region" text, "date" text, "format" text, "version(s)" text, "label" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the first country to get the radio ad ?
SELECT "region" FROM table_204_17 ORDER BY "date" LIMIT 1
squall
CREATE TABLE Rooms ( roomName VARCHAR, basePrice VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which room has cheapest base price? List the room's name and the base price.
SELECT roomName, basePrice FROM Rooms ORDER BY basePrice LIMIT 1
sql_create_context
CREATE TABLE Rooms ( roomName VARCHAR, maxOccupancy VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find the name of the room with the maximum occupancy.
SELECT roomName FROM Rooms ORDER BY maxOccupancy DESC LIMIT 1
sql_create_context
CREATE TABLE table_name_25 ( all_amendments_cosponsored INTEGER, amendments_originally_cosponsored VARCHAR, all_bills_sponsored VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest number of amendments cosponsored associated with 53 amendme...
SELECT MAX(all_amendments_cosponsored) FROM table_name_25 WHERE amendments_originally_cosponsored = 53 AND all_bills_sponsored > 54
sql_create_context
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("housemates") FROM table_203_397
squall
CREATE TABLE table_73963 ( "Member countries" text, "Population" text, "Area (km\u00b2)" text, "GDP (billion US$)" text, "GDP per capita (US$)" text, "Languages" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the area for german
SELECT "Area (km\u00b2)" FROM table_73963 WHERE "Languages" = 'German'
wikisql
CREATE TABLE txmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZ...
SELECT person_info.JGDM, person_info.JGMC, COUNT(person_info.RYBH) FROM person_info JOIN hz_info JOIN txmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX WHERE txmzjzjlb.JZZDSM = '牙体缺损' GROUP BY person_info.JGDM UNION SELECT pe...
css
CREATE TABLE table_27462209_1 ( written_by VARCHAR, prod_code VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name who wrote the production code 322
SELECT written_by FROM table_27462209_1 WHERE prod_code = 322
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "23" AND prescriptions.drug = "Ondansetron ODT"
mimicsql_data
CREATE TABLE table_36374 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Game Site" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Opponent of at boston patriots, and a Week larger than 3 had wh...
SELECT AVG("Attendance") FROM table_36374 WHERE "Opponent" = 'at boston patriots' AND "Week" > '3'
wikisql
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.admission_type = "EMERGENCY" AND demographic.dod_year < "2155.0"
mimicsql_data
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALA...
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY SUM(EMPLOYEE_ID) DESC
nvbench
CREATE TABLE table_46307 ( "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. -- What w...
SELECT SUM("Game") FROM table_46307 WHERE "Team" = 'toronto'
wikisql
CREATE TABLE table_73212 ( "Shareholder" text, "s A share" real, "s B share" real, "Percent of capital" text, "Percent of votes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What shareholder has 3.63 percent of capital?
SELECT "Shareholder" FROM table_73212 WHERE "Percent of capital" = '3.63'
wikisql
CREATE TABLE market ( Market_ID int, Country text, Number_cities int ) CREATE TABLE film ( Film_ID int, Title text, Studio text, Director text, Gross_in_dollar int ) CREATE TABLE film_market_estimation ( Estimation_ID int, Low_Estimate real, High_Estimate real, Film_ID ...
SELECT Type, COUNT(Type) FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID GROUP BY Type
nvbench
CREATE TABLE table_16609 ( "Wicket" text, "Runs" text, "Batting partners" text, "Batting team" text, "Fielding team" text, "Venue" text, "Season" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the batting team where the runs are 276?...
SELECT "Batting team" FROM table_16609 WHERE "Runs" = '276'
wikisql
CREATE TABLE bank ( Id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many bank branches are there?
SELECT COUNT(*) FROM bank
sql_create_context
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, ...
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'chr ischemic hrt d...
mimic_iii
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 * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jy...
css
CREATE TABLE party ( Party_ID int, Year real, Party text, Governor text, Lieutenant_Governor text, Comptroller text, Attorney_General text, US_Senate text ) CREATE TABLE election ( Election_ID int, Counties_Represented text, District int, Delegate text, Party int, ...
SELECT Comptroller, COUNT(Comptroller) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2 GROUP BY Comptroller ORDER BY Comptroller
nvbench
CREATE TABLE table_4654 ( "Race Name" text, "Circuit" text, "City/Location" text, "Date" text, "Pole position" text, "Winning driver" text, "Winning team" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For the race held at...
SELECT "Winning team" FROM table_4654 WHERE "Winning driver" = 'emerson fittipaldi' AND "Pole position" = 'michael andretti' AND "Circuit" = 'cleveland burke lakefront airport'
wikisql
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN jybgb_jyjgzbb ON person_info.RYBH = hz_info.RYBH AND 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 = j...
css
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId numb...
SELECT p.Id AS "post_link", p.Id, p.Title, p.CommentCount, p.Body, c.Text, p.ViewCount, a.Score FROM Posts AS p LEFT JOIN Comments AS c ON p.Id = c.PostId INNER JOIN Posts AS a ON a.ParentId = p.Id WHERE p.PostTypeId = 1 OR p.PostTypeId = 2 AND p.Tags = '%##tagname##%' AND p.Title LIKE '%##keyword##%' ORDER BY ViewCoun...
sede
CREATE TABLE table_1341738_6 ( candidates VARCHAR, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who were the candidates in the election that featured incumbent don edwards?
SELECT candidates FROM table_1341738_6 WHERE incumbent = "Don Edwards"
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_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 '2011-09-02' AND '2012-12-04' AND t_kc21.MED_SER_ORG_NO = '2066190' AND t_kc22.MED_INV_ITEM_TYPE = '检查费'
css
CREATE TABLE table_72676 ( "Round" text, "Race" real, "Circuit" text, "Date" text, "Pole Position" text, "Fastest Lap" text, "Winning driver" text, "Winning team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest race nu...
SELECT MAX("Race") FROM table_72676 WHERE "Circuit" = 'Phillip Island' AND "Winning driver" = 'James Winslow' AND "Pole Position" = 'James Winslow'
wikisql
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text ...
SELECT PostId AS "post_link", Text, Score FROM Comments WHERE UserId = '##UserId##' AND Text LIKE '%##Search##%' ORDER BY CreationDate DESC
sede
CREATE TABLE table_58418 ( "Name" text, "Dates active" text, "Windspeeds" text, "Pressure" text, "Deaths" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was there 204 deaths?
SELECT "Dates active" FROM table_58418 WHERE "Deaths" = '204'
wikisql
CREATE TABLE table_204_760 ( id number, "year" number, "competition" text, "venue" text, "position" text, "event" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which of each game in 2007 was in the 2nd position ?
SELECT "competition" FROM table_204_760 WHERE "year" = 2007 AND "position" = 2
squall
CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD...
SELECT t_kc21.MED_ORG_DEPT_CD, t_kc21.MED_ORG_DEPT_NM FROM t_kc21 WHERE t_kc21.MED_CLINIC_ID = '91661477964'
css
CREATE TABLE mzjzjlb ( YLJGDM text, JZLSH text, KH text, KLX number, MJZH text, HZXM text, NLS number, NLY number, ZSEBZ number, JZZTDM number, JZZTMC text, JZJSSJ time, TXBZ number, ZZBZ number, WDBZ number, JZKSBM text, JZKSMC text, JZKSRQ time, ...
SELECT mzjzjlb.JZLSH FROM person_info JOIN hz_info JOIN mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE person_info.XM = '王清妍' AND NOT mzjzjlb.JZLSH IN (SELECT JZLSH FROM jybgb WHERE BGRQ <= '2004-06-19')
css
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE labevents ( row_id number, ...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admi...
mimic_iii
CREATE TABLE table_name_31 ( results¹ VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What were the results on September 7?
SELECT results¹ FROM table_name_31 WHERE date = "september 7"
sql_create_context
CREATE TABLE table_16710971_2 ( falcons_points VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many points did the Falcons score when the record was 4-4?
SELECT falcons_points FROM table_16710971_2 WHERE record = "4-4"
sql_create_context
CREATE TABLE table_15201 ( "Tournament" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the tournament for 2012 grand slam tournaments
SELECT "Tournament" FROM table_15201 WHERE "2012" = 'grand slam tournaments'
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
SELECT demographic.gender, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "2560"
mimicsql_data
CREATE TABLE table_39104 ( "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 smallest number of total medals for Georgia with 0 silver and 1 bronze?
SELECT MIN("Total") FROM table_39104 WHERE "Silver" > '0' AND "Nation" = 'georgia' AND "Bronze" < '1'
wikisql
CREATE TABLE table_name_68 ( surface VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the surface in 1996?
SELECT surface FROM table_name_68 WHERE year = 1996
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT demographic.days_stay, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Troy Friedman"
mimicsql_data
CREATE TABLE zyjybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH number, 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, ...
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN mzjzjlb JOIN zyjybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZJZJLB AND zyjybgb.YLJGDM = jyjgzbb.YLJGDM AND zyjybgb.BGDH ...
css
CREATE TABLE table_17160 ( "Suburb" text, "Population (in 2008)" real, "Median age (in 2006)" text, "Mean household size (in 2006)" text, "Area (km\u00b2)" text, "Density (/km\u00b2)" real, "Date first settled as a suburb" real, "Gazetted as a Division Name" text ) -- Using valid SQLit...
SELECT MIN("Density (/km\u00b2)") FROM table_17160 WHERE "Suburb" = 'Garran'
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 prescription...
SELECT lab.flag FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.name = "Jerry Deberry"
mimicsql_data
CREATE TABLE table_78808 ( "Geelong DFL" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of losses where the byes were greater than 0?
SELECT COUNT("Losses") FROM table_78808 WHERE "Byes" > '0'
wikisql
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 t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'azithromycin 500 mg iv solr') AS t1 JOIN (SELECT pa...
eicu