instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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, ...
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN zyjybgb 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 = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZ...
css
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 location, restaurant WHERE location.city_name = 'san francisco' AND location.street_name = 'buchanan' AND restaurant.food_type = 'arabic' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5
restaurants
CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE keyphrase ( keyphraseid int, keyphrase...
SELECT DISTINCT writes.authorid FROM paper, writes WHERE paper.year = 2015 AND writes.paperid = paper.paperid
scholar
CREATE TABLE table_36743 ( "District" text, "Incumbent" text, "Party" text, "First elected" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the incumbent for south carolina 3 district?
SELECT "Incumbent" FROM table_36743 WHERE "District" = 'south carolina 3'
wikisql
CREATE TABLE person_info ( RYBH text, XBDM number, XBMC text, XM text, CSRQ time, CSD text, MZDM text, MZMC text, GJDM text, GJMC text, JGDM text, JGMC text, XLDM text, XLMC text, ZYLBDM text, ZYMC text ) CREATE TABLE hz_info ( KH text, KLX number...
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 hz_info.YLJGDM = '3113072' AND NOT mzjzjlb.JZKSMC LIKE '%产科%'
css
CREATE TABLE table_name_59 ( points INTEGER, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which line has the lowest amount of points and a year of 1954?
SELECT MIN(points) FROM table_name_59 WHERE year = 1954
sql_create_context
CREATE TABLE table_name_7 ( round INTEGER, event VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many rounds was the fight at UFC 34?
SELECT SUM(round) FROM table_name_7 WHERE event = "ufc 34"
sql_create_context
CREATE TABLE table_34324 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Record has a Time of 4:50?
SELECT "Record" FROM table_34324 WHERE "Time" = '4:50'
wikisql
CREATE TABLE table_name_34 ( peak_population__year_ VARCHAR, city VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the peak population (year) for scranton?
SELECT peak_population__year_ FROM table_name_34 WHERE city = "scranton"
sql_create_context
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 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 ...
css
CREATE TABLE table_name_98 ( game_site VARCHAR, week VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the game site for week of 1
SELECT game_site FROM table_name_98 WHERE week = "1"
sql_create_context
CREATE TABLE table_17503169_1 ( democratic VARCHAR, republican VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the democratic candidate when the republican was frank wolf?
SELECT democratic FROM table_17503169_1 WHERE republican = "Frank Wolf"
sql_create_context
CREATE TABLE table_203_874 ( 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. -- how long did it take to walk 50 km in the 2004 olympic games ?
SELECT "notes" FROM table_203_874 WHERE "event" = '50 km walk' AND "year" = 2004
squall
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, Rejection...
SELECT AVG(1.0 * AnswerCount) FROM Posts WHERE PostTypeId = 1 AND Score > 0
sede
CREATE TABLE Apartment_Facilities ( apt_id INTEGER, facility_code CHAR(15) ) CREATE TABLE Apartments ( apt_id INTEGER, building_id INTEGER, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, bedroom_count INTEGER, room_count CHAR(5) ) CREATE TABLE Apartment_Buildi...
SELECT apt_type_code, COUNT(apt_type_code) FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_manager = "Kyle" GROUP BY apt_type_code ORDER BY apt_type_code
nvbench
CREATE TABLE table_name_36 ( time VARCHAR, period VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What time does Dustin Byfuglien have in 1st period?
SELECT time FROM table_name_36 WHERE period = "1st" AND player = "dustin byfuglien"
sql_create_context
CREATE TABLE table_18600760_9 ( longitude VARCHAR, ansi_code VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the longitude of the township at ANSI code 1759682?
SELECT longitude FROM table_18600760_9 WHERE ansi_code = 1759682
sql_create_context
CREATE TABLE table_23255941_1 ( written_by VARCHAR, directed_by VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many writers were there in the episode directed by Charles Haid?
SELECT COUNT(written_by) FROM table_23255941_1 WHERE directed_by = "Charles Haid"
sql_create_context
CREATE TABLE table_247955_2 ( margin_of_victory VARCHAR, runner_s__up VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the margin of victory when runner-up was K. J. Choi?
SELECT margin_of_victory FROM table_247955_2 WHERE runner_s__up = "K. J. Choi"
sql_create_context
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 text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Government" AND procedures.short_title = "Part sm bowel resect NEC"
mimicsql_data
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 countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_...
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID
nvbench
CREATE TABLE table_4346 ( "Event" text, "Time" text, "Nationality" text, "Date" text, "Meet" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the location of lithuania 12 october 2013
SELECT "Location" FROM table_4346 WHERE "Nationality" = 'lithuania' AND "Date" = '12 october 2013'
wikisql
CREATE TABLE table_204_666 ( id number, "ime exchange (including spot, credit and forward transactions)" text, "2007/08" number, "2008/09" number, "2009/10" number, "2010/11" number, "2011/12" number ) -- Using valid SQLite, answer the following questions for the tables provided above. --...
SELECT "2008/09" FROM table_204_666 WHERE "ime exchange (including spot, credit and forward transactions)" = 'agricultural - value (billion rials)'
squall
CREATE TABLE table_25795 ( "Rank" real, "City/Town" text, "County" text, "Region/Province" text, "Population" real, "Country" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When 31901 is the population what is the county?
SELECT "County" FROM table_25795 WHERE "Population" = '31901'
wikisql
CREATE TABLE table_35578 ( "Rank" real, "Gold" real, "Silver" real, "Bronze" real, "Total" real, "Participants" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest number of Golds that has Participants smaller than 14, and Rank of ...
SELECT MIN("Gold") FROM table_35578 WHERE "Participants" < '14' AND "Rank" = '1' AND "Total" > '1'
wikisql
CREATE TABLE station ( lat INTEGER, long INTEGER, city VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average latitude and longitude of stations located in San Jose city?
SELECT AVG(lat), AVG(long) FROM station WHERE city = "San Jose"
sql_create_context
CREATE TABLE table_name_86 ( date VARCHAR, away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was the game with richmond as Away team?
SELECT date FROM table_name_86 WHERE away_team = "richmond"
sql_create_context
CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_g...
SELECT DISTINCT student.firstname, student.lastname FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN gsi ON gsi.course_offering_id = course_offering.offering_id INNER JOIN student ON student.student_id = gsi.student_id INNER JOIN semester ON semester.semester_id = course...
advising
CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE dual_c...
SELECT DISTINCT flight.arrival_time, flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND C...
atis
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "34291" AND lab.fluid = "Ascites"
mimicsql_data
CREATE TABLE table_67374 ( "Year" text, "Men's singles" text, "Men's doubles" text, "Women's doubles" text, "Mixed doubles" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What were the names of the mixed doubles pair for the year that Ralph Nichols ...
SELECT "Mixed doubles" FROM table_67374 WHERE "Men's singles" = 'ralph nichols'
wikisql
CREATE TABLE table_69702 ( "Date" text, "Opponents" text, "Result F\u2013A" text, "Attendance" real, "Group position" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Group position of 1st, and a Result F A of 2 0 has what average attendance?
SELECT AVG("Attendance") FROM table_69702 WHERE "Group position" = '1st' AND "Result F\u2013A" = '2–0'
wikisql
CREATE TABLE table_40036 ( "Country" text, "Local name" text, "Host" text, "Network" text, "Date premiered" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Network has a Local name of moj tata je bolji od tvog tate?
SELECT "Network" FROM table_40036 WHERE "Local name" = 'moj tata je bolji od tvog tate'
wikisql
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE ReviewTaskResults ( Id number, Review...
SELECT p.OwnerUserId AS "user_link", COUNT(p.Id) AS "answers" FROM Posts AS p JOIN Posts AS q ON q.AcceptedAnswerId = p.Id WHERE q.PostTypeId = 1 AND p.PostTypeId = 2 AND NOT p.OwnerUserId IS NULL AND p.DeletionDate IS NULL AND RIGHT(CAST(TIME_TO_STR(p.CreationDate, '%d/%m/%Y') AS TEXT(10)), 7) = '##Month:string##' GRO...
sede
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 jybgb.BBDM, jybgb.BBMC, jybgb.BBZT FROM jybgb WHERE jybgb.BGDH = '87858204866'
css
CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER ) CREATE TABLE station ( id INTEG...
SELECT date, COUNT(date) FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31 ORDER BY COUNT(date)
nvbench
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location...
SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, 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 FR...
mimic_iii
CREATE TABLE table_name_85 ( surface VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Surface, when Date is 2 May 1999?
SELECT surface FROM table_name_85 WHERE date = "2 may 1999"
sql_create_context
CREATE TABLE table_14294 ( "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's the total when the bronze was more than 1, silver was 3, and gold was less than 5?
SELECT SUM("Total") FROM table_14294 WHERE "Bronze" > '1' AND "Silver" = '3' AND "Gold" < '5'
wikisql
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 person_info.XM FROM person_info JOIN hz_info JOIN zzmzjzjlb JOIN jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE jybgb.BGDH = '9...
css
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImage...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE 'nigeria%' ORDER BY Reputation DESC LIMIT 10
sede
CREATE TABLE table_name_68 ( time_retired VARCHAR, laps VARCHAR, grid VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Time/Retired has less than 77 laps, and a Grid of 16?
SELECT time_retired FROM table_name_68 WHERE laps < 77 AND grid = 16
sql_create_context
CREATE TABLE routes ( rid number, dst_apid number, dst_ap text, src_apid number, src_ap text, alid number, airline text, codeshare text ) CREATE TABLE airports ( apid number, name text, city text, country text, x number, y number, elevation number, iata t...
SELECT COUNT(*), city FROM airports WHERE country = 'United States' GROUP BY city ORDER BY COUNT(*) DESC
spider
CREATE TABLE table_name_98 ( venue VARCHAR, crowd INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What venue featured a crowd of over 30,000?
SELECT venue FROM table_name_98 WHERE crowd > 30 OFFSET 000
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_DIRE_CD text, MED_DIRE_NM text,...
SELECT SUM(t_kc24.PER_ACC_PAY) FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '戚鸿振' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2002-11-12' AND '2012-08-09'
css
CREATE TABLE table_name_14 ( date VARCHAR, tournament VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which date has a Tournament of la quinta?
SELECT date FROM table_name_14 WHERE tournament = "la quinta"
sql_create_context
CREATE TABLE table_29313 ( "Stage" real, "Stage winner" text, "General classification" text, "Points classification" text, "Mountains classification" text, "Asian rider classification" text, "Team classification" text ) -- Using valid SQLite, answer the following questions for the tables p...
SELECT "Points classification" FROM table_29313 WHERE "Stage winner" = 'Malcolm Lange'
wikisql
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
SELECT COUNT(DISTINCT MED_SER_ORG_NO) FROM t_kc21 WHERE PERSON_NM = '周雅韶' AND IN_HOSP_DATE BETWEEN '2015-04-12' AND '2020-11-25'
css
CREATE TABLE table_21557 ( "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 "Score" FROM table_21557 WHERE "High rebounds" = 'Jeff Foster (10)'
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 prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "36" AND lab."CATEGORY" = "Blood Gas"
mimicsql_data
CREATE TABLE submission ( College VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show different colleges along with the number of authors of submission from each college.
SELECT College, COUNT(*) FROM submission GROUP BY College
sql_create_context
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY SUM(MANAGER_ID)
nvbench
CREATE TABLE schedule ( Cinema_ID int, Film_ID int, Date text, Show_times_per_day int, Price float ) CREATE TABLE cinema ( Cinema_ID int, Name text, Openning_year int, Capacity int, Location text ) CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_seaso...
SELECT Name, Capacity FROM cinema ORDER BY Capacity DESC
nvbench
CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_p...
SELECT COUNT(*) > 0 FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'SAC' AND course.number = 375 AND instructor.name LIKE '%Yan-chun Tung%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.o...
advising
CREATE TABLE table_38998 ( "Result" text, "Record" text, "Opponent" text, "Rd, Time" text, "Date" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the location that led to a record of 9-0-0?
SELECT "Location" FROM table_38998 WHERE "Record" = '9-0-0'
wikisql
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 text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose 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.short_title = "NB obsrv suspct infect" AND lab."CATEGORY" = "Hematology"
mimicsql_data
CREATE TABLE projects ( code text, name text, hours number ) CREATE TABLE scientists ( ssn number, name text ) CREATE TABLE assignedto ( scientist number, project text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the names of scienti...
SELECT name FROM scientists WHERE NOT ssn IN (SELECT scientist FROM assignedto)
spider
CREATE TABLE table_name_8 ( partnering VARCHAR, against VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was partnering when nueza silva played against greece?
SELECT partnering FROM table_name_8 WHERE against = "greece"
sql_create_context
CREATE TABLE Tourist_Attraction_Features ( Tourist_Attraction_ID INTEGER, Feature_ID INTEGER ) CREATE TABLE Visits ( Visit_ID INTEGER, Tourist_Attraction_ID INTEGER, Tourist_ID INTEGER, Visit_Date DATETIME, Visit_Details VARCHAR(40) ) CREATE TABLE Visitors ( Tourist_ID INTEGER, Tou...
SELECT Name, COUNT(*) FROM Tourist_Attractions AS T1 JOIN Visits AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_75615 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Save" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who earned the save in the game against the Sinon Bulls when Jeriome Robertson took the loss?
SELECT "Save" FROM table_75615 WHERE "Opponent" = 'sinon bulls' AND "Loss" = 'jeriome robertson'
wikisql
CREATE TABLE table_204_133 ( id number, "school year" text, "class a" text, "class aa" text, "class aaa" text, "class aaaa" text, "class aaaaa" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the only year keene won class aa ?
SELECT "school year" FROM table_204_133 WHERE "class aa" = 'keene'
squall
CREATE TABLE table_26686 ( "Episode number Production number" text, "Title" text, "Original airdate" text, "Time of airing" text, "Total viewers on Hallmark" real, "Total viewers on Hallmark+1" real, "Total viewers" real, "Rank on channel" text ) -- Using valid SQLite, answer the follo...
SELECT "Total viewers on Hallmark+1" FROM table_26686 WHERE "Title" = 'Pilot'
wikisql
CREATE TABLE airports ( apid integer, name text, city text, country text, x real, y real, elevation bigint, iata character varchar(3), icao character varchar(4) ) CREATE TABLE routes ( rid integer, dst_apid integer, dst_ap varchar(4), src_apid bigint, src_ap varc...
SELECT name, elevation FROM airports WHERE city = 'New York' ORDER BY elevation DESC
nvbench
CREATE TABLE Band ( Id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many bands are there?
SELECT COUNT(*) FROM Band
sql_create_context
CREATE TABLE table_203_661 ( id number, "year" number, "single" text, "peak chart positions\nus mod" number, "peak chart positions\nuk" number, "album" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the first single to earn a chart posi...
SELECT "single" FROM table_203_661 WHERE NOT "peak chart positions\nus mod" IS NULL ORDER BY "year" LIMIT 1
squall
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
SELECT demographic.admittime, demographic.dischtime FROM demographic WHERE demographic.name = "Charles Nilsson"
mimicsql_data
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. -- how many races did ricky stenhouse , jr. when during this season ?
SELECT COUNT("race") FROM table_204_630 WHERE "winner" = 'ricky stenhouse, jr'
squall
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_Road, AVG(School_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY AVG(School_ID)
nvbench
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight i...
SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((flight.airline_code = 'AA') AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND flight.to_airport = AIRPORT_SER...
atis
CREATE TABLE table_15469 ( "Year" real, "English title" text, "Original title" text, "Country" text, "Director" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the english title for mexico/spain/usa
SELECT "English title" FROM table_15469 WHERE "Country" = 'mexico/spain/usa'
wikisql
CREATE TABLE table_train_207 ( "id" int, "anemia" bool, "hemoglobin_a1c_hba1c" float, "diabetic" string, "body_mass_index_bmi" float, "age" float, "NOUSE" float ) -- Using valid SQLite, answer the following questions for the tables provided above. -- age 14 _ 18
SELECT * FROM table_train_207 WHERE age >= 14 AND age <= 18
criteria2sql
CREATE TABLE table_14719 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the earliest year for a car with 3 points and Cooper t20 chassis?
SELECT MIN("Year") FROM table_14719 WHERE "Points" = '3' AND "Chassis" = 'cooper t20'
wikisql
CREATE TABLE table_name_49 ( bats VARCHAR, throws VARCHAR, dob VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Bats have Throws of r, and a DOB of 22 may 1973?
SELECT bats FROM table_name_49 WHERE throws = "r" AND dob = "22 may 1973"
sql_create_context
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostLinks ( Id number, Crea...
SELECT vob.BountyAmount AS "bounty", LEFT(DATEADD(d, 7, vob.CreationDate), 6) AS "until", p.Id AS "post_link", p.Tags FROM Posts AS p LEFT JOIN Votes AS vob ON vob.PostId = p.Id AND vob.VoteTypeId = 8 LEFT JOIN PostTags AS pt ON p.Id = pt.PostId LEFT JOIN Tags AS t ON pt.TagId = t.Id WHERE p.ClosedDate IS NULL AND NOT ...
sede
CREATE TABLE table_15491596_1 ( constructor VARCHAR, no VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the constructor of car 22?
SELECT constructor FROM table_15491596_1 WHERE no = 22
sql_create_context
CREATE TABLE table_31148 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the production cod...
SELECT MIN("Production code") FROM table_31148 WHERE "Title" = 'You Don''t Know Dick'
wikisql
CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airp...
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 ((flight.departure_time <= 900 AND flight.departure_time >= 600) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.to...
atis
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.admityear < "2139"
mimicsql_data
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.department = '...
advising
CREATE TABLE table_20025 ( "Date" text, "Tournament" text, "Location" text, "Purse( $ )" real, "Winner" text, "Score" text, "1st Prize( $ )" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What day did Bernhard Langer (2) win?
SELECT "Date" FROM table_20025 WHERE "Winner" = 'Bernhard Langer (2)'
wikisql
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_ID = '01420537' AND MED_SER_ORG_NO = '2864800' AND NOT IN_DIAG_DIS_NM LIKE '%脑瘫%'
css
CREATE TABLE table_60364 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lwoest round of wild bill's fight night...
SELECT MIN("Round") FROM table_60364 WHERE "Time" = '5:00' AND "Event" = 'wild bill''s fight night 21'
wikisql
CREATE TABLE table_47746 ( "Round" text, "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. -- What round has Team #2 Gomel?
SELECT "Round" FROM table_47746 WHERE "Team #2" = 'gomel'
wikisql
CREATE TABLE table_6887 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-10" real, "Top-25" real, "Events" real, "Cuts made" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the total number of Cuts made, when Top-5 was greater th...
SELECT COUNT("Cuts made") FROM table_6887 WHERE "Top-5" > '3' AND "Events" = '85'
wikisql
CREATE TABLE table_name_70 ( silver INTEGER, gold VARCHAR, total VARCHAR, bronze VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the sum of Silver with total smaller than 560, a Bronze larger than 6, and a Gold of 3?
SELECT SUM(silver) FROM table_name_70 WHERE total < 560 AND bronze > 6 AND gold = 3
sql_create_context
CREATE TABLE table_57111 ( "College Name" text, "Location" text, "District" text, "Affiliation" text, "Estd" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the location of the kanyakumari government medical college?
SELECT "Location" FROM table_57111 WHERE "College Name" = 'kanyakumari government medical college'
wikisql
CREATE TABLE table_203_568 ( id number, "town/village" text, "population" number, "postal code" text, "municipality" text, "island" text, "location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many people does argir have ?
SELECT "population" FROM table_203_568 WHERE "town/village" = 'argir'
squall
CREATE TABLE table_204_676 ( id number, "year" number, "division" number, "league" text, "regular season" text, "playoffs" text, "open cup" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the last year this team played in the league ...
SELECT MAX("year") FROM table_204_676
squall
CREATE TABLE business ( bid int, business_id varchar, name varchar, full_address varchar, city varchar, latitude varchar, longitude varchar, review_count bigint, is_open tinyint, rating float, state varchar ) CREATE TABLE neighborhood ( id int, business_id varchar, ...
SELECT COUNT(DISTINCT (business.name)) FROM business, category WHERE category.business_id = business.business_id AND category.category_name = 'restaurant'
yelp
CREATE TABLE table_204_487 ( id number, "home team" text, "score" text, "visiting team" text, "location" text, "venue" text, "door" text, "surface" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- number of total goals scored in the round
SELECT SUM("score" + "score") FROM table_204_487
squall
CREATE TABLE table_203_312 ( id number, "name" text, "club" text, "position" text, "years" text, "current status" text, "international caps" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many players have above 40 international caps ?...
SELECT COUNT("name") FROM table_203_312 WHERE "international caps" > 40
squall
CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE instructor ( ...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Clara Verweij%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.off...
advising
CREATE TABLE Undergoes ( Patient INTEGER, Procedures INTEGER, Stay INTEGER, DateUndergoes DATETIME, Physician INTEGER, AssistingNurse INTEGER ) CREATE TABLE Department ( DepartmentID INTEGER, Name VARCHAR(30), Head INTEGER ) CREATE TABLE Prescribes ( Physician INTEGER, Pati...
SELECT Name, COUNT(*) FROM Medication AS T1 JOIN Prescribes AS T2 ON T1.Code = T2.Medication GROUP BY T1.Brand ORDER BY Name DESC
nvbench
CREATE TABLE table_48074 ( "State" text, "Abbreviation" text, "Capital" text, "Area (km\u00b2)" real, "Population (2005)" real, "Density (2005)" real, "GDP (% total) (2004)" text, "GDP per capita (US$) (2004)" real, "HDI (2005)" real, "Literacy (2003)" text, "Infant Mortality...
SELECT "Literacy (2003)" FROM table_48074 WHERE "HDI (2005)" < '0.718' AND "GDP per capita (US$) (2004)" < '3877' AND "State" = 'maranhão'
wikisql
CREATE TABLE projects ( project_id number, organisation_id number, project_details text ) CREATE TABLE documents ( document_id number, document_type_code text, grant_id number, sent_date time, response_received_date time, other_details text ) CREATE TABLE grants ( grant_id numb...
SELECT T1.organisation_type, T1.organisation_id FROM organisations AS T1 JOIN research_staff AS T2 ON T1.organisation_id = T2.employer_organisation_id GROUP BY T1.organisation_id ORDER BY COUNT(*) DESC LIMIT 1
spider
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.religion = "CHRISTIAN SCIENTIST" AND diagnoses.short_title = "Atrial fibrillation"
mimicsql_data
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 OUT_DIAG_DIS_CD, OUT_DIAG_DIS_NM FROM t_kc21 WHERE PERSON_ID = '10674984' AND MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc24 WHERE MED_AMOUT >= 3779.26)
css
CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE...
SELECT meter_200, SUM(ID) FROM swimmer GROUP BY meter_200
nvbench
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABL...
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 68233 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND prescriptions.drug = 'aspirin'
mimic_iii
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE PendingFlags ( ...
SELECT t.TagName, p.LastEditDate, 'site://edit-tag-wiki/' + CAST(t.Id AS TEXT) AS "Link" FROM Posts AS p INNER JOIN Tags AS t ON p.Id = t.ExcerptPostId WHERE p.Body LIKE '%Stack%Overflow%' ORDER BY p.LastEditDate
sede