instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE shop ( Shop_ID int, Address text, Num_of_staff text, Score real, Open_Year text ) CREATE TABLE happy_hour ( HH_ID int, Shop_ID int, Month text, Num_of_shaff_in_charge int ) CREATE TABLE member ( Member_ID int, Name text, Membership_card text, Age int, ...
SELECT Address, COUNT(*) FROM member GROUP BY Address
nvbench
CREATE TABLE table_11545282_5 ( player VARCHAR, no VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which player is no. 53?
SELECT player FROM table_11545282_5 WHERE no = "53"
sql_create_context
CREATE TABLE party_events ( Event_ID int, Event_Name text, Party_ID int, Member_in_charge_ID int ) CREATE TABLE region ( Region_ID int, Region_name text, Date text, Label text, Format text, Catalogue text ) CREATE TABLE member ( Member_ID int, Member_Name text, Part...
SELECT Minister, COUNT(Minister) FROM party GROUP BY Minister ORDER BY Minister
nvbench
CREATE TABLE table_name_87 ( player VARCHAR, pick VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the player with pick 19?
SELECT player FROM table_name_87 WHERE pick = "19"
sql_create_context
CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP_DOB datetime ) CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1),...
SELECT EMP_FNAME, COUNT(EMP_FNAME) FROM EMPLOYEE WHERE EMP_JOBCODE = 'PROF' GROUP BY EMP_FNAME ORDER BY EMP_DOB
nvbench
CREATE TABLE ref_document_types ( document_type_code text, document_type_name text, document_type_description text ) CREATE TABLE documents_with_expenses ( document_id number, budget_type_code text, document_details text ) CREATE TABLE projects ( project_id number, project_details text...
SELECT document_type_description FROM ref_document_types WHERE document_type_name = "Film"
spider
CREATE TABLE table_2397 ( "District" text, "Capital City" text, "Area (km\u00b2)" real, "Area (sq.mi)" real, "Population (2005 est)" real, "2-letter abbreviation" text, "3-letter abbreviation" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- W...
SELECT MIN("Area (km\u00b2)") FROM table_2397 WHERE "2-letter abbreviation" = 'CY'
wikisql
CREATE TABLE table_24984 ( "Year" text, "Chairman" text, "Artistic Director" text, "Performance Liaison" text, "Secretary" text, "Business manager" text, "Production Stagemanager" text, "Dramaturge" text, "Public Relations" text, "First/Second Year Rep." text, "Male Rep." tex...
SELECT "First/Second Year Rep." FROM table_24984 WHERE "Performance Liaison" = 'Kira Josephson'
wikisql
CREATE TABLE table_25820 ( "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. -- When r...
SELECT "Team" FROM table_25820 WHERE "High points" = 'Rashard Lewis (24)'
wikisql
CREATE TABLE table_name_42 ( away_team VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Away team score has a Venue of kardinia park?
SELECT away_team AS score FROM table_name_42 WHERE venue = "kardinia park"
sql_create_context
CREATE TABLE table_26037 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Prod. code" text, "U.S. Viewers (in millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided abo...
SELECT MIN("No. in series") FROM table_26037 WHERE "Written by" = 'Bernie Ancheta' AND "No. in season" = '5'
wikisql
CREATE TABLE table_train_250 ( "id" int, "gender" string, "waist_to_hip_ratio" float, "creatinine_clearance_cl" float, "panel_reactive_antibodies" int, "insulin_requirement" float, "serum_creatinine" float, "NOUSE" float ) -- Using valid SQLite, answer the following questions for the t...
SELECT * FROM table_train_250 WHERE serum_creatinine >= 1.3 AND gender = 'female'
criteria2sql
CREATE TABLE table_62024 ( "Year" real, "Average" text, "High" real, "Sellouts" real, "Total for year" real, "WNBA game average" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many years in all was less than 105,005 the total for the year?
SELECT COUNT("Year") FROM table_62024 WHERE "Total for year" < '105,005'
wikisql
CREATE TABLE Things ( thing_id INTEGER, organization_id INTEGER, Type_of_Thing_Code CHAR(15), service_type_code CHAR(10), service_details VARCHAR(255) ) CREATE TABLE Properties ( property_id INTEGER, property_type_code CHAR(15), property_address VARCHAR(255), other_details VARCHAR(2...
SELECT Type_of_Thing_Code, COUNT(Type_of_Thing_Code) FROM Things GROUP BY Type_of_Thing_Code
nvbench
CREATE TABLE table_204_809 ( id number, "draw" number, "country" text, "language" text, "artist" text, "song" text, "english translation" text, "national final" text, "place" number, "points" number ) -- Using valid SQLite, answer the following questions for the tables provided...
SELECT "country" FROM table_204_809 ORDER BY "place" LIMIT 1
squall
CREATE TABLE table_20560 ( "Code" text, "District" text, "Headquarters" text, "Population (2011)" real, "Area (km\u00b2)" real, "Density (/km\u00b2)" real, "Official website" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where is the headqu...
SELECT "Headquarters" FROM table_20560 WHERE "Population (2011)" = '3811738'
wikisql
CREATE TABLE table_37936 ( "Name" text, "Faith" text, "Type" text, "DCSF number" real, "Ofsted number" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which faith has a name of Belswains?
SELECT "Faith" FROM table_37936 WHERE "Name" = 'belswains'
wikisql
CREATE TABLE table_10198 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What driver had under 22 laps and a Time/Retired of ignition?
SELECT "Driver" FROM table_10198 WHERE "Laps" < '22' AND "Time/Retired" = 'ignition'
wikisql
CREATE TABLE table_76625 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" text, "Time" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the opponent when the fight had a time of 2:01?
SELECT "Opponent" FROM table_76625 WHERE "Time" = '2:01'
wikisql
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, sy...
SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'ventilatory failure - drug related' AND DATETIME(dia...
eicu
CREATE TABLE table_name_12 ( valvetrain VARCHAR, model VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Valvetrain of the Diesel Engines Model?
SELECT valvetrain FROM table_name_12 WHERE model = "diesel engines"
sql_create_context
CREATE TABLE people ( People_ID int, Name text, Height real, Weight real, Date_of_Birth text ) CREATE TABLE entrepreneur ( Entrepreneur_ID int, People_ID int, Company text, Money_Requested real, Investor text ) -- Using valid SQLite, answer the following questions for the tabl...
SELECT Investor, COUNT(*) FROM entrepreneur GROUP BY Investor
nvbench
CREATE TABLE table_name_84 ( start VARCHAR, laps VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where was the starting position when there were 182 laps?
SELECT start FROM table_name_84 WHERE laps = 182
sql_create_context
CREATE TABLE table_274117_5 ( position VARCHAR, year_of_induction_into_pro_football_hall_of_fame VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What position was the player who was inducted into the Pro Football Hall of Fame in 1980?
SELECT position FROM table_274117_5 WHERE year_of_induction_into_pro_football_hall_of_fame = "1980"
sql_create_context
CREATE TABLE table_55323 ( "Date" text, "Venue" text, "Result" text, "Competition" text, "Scored" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- At what venue did Sigurd Rushfeldt score 1 point in the 2006 FIFA World Cup Qualification competition?
SELECT "Venue" FROM table_55323 WHERE "Scored" = '1' AND "Competition" = '2006 fifa world cup qualification'
wikisql
CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTas...
SELECT * FROM Posts AS q INNER JOIN PostHistory AS h ON q.Id = h.PostId WHERE h.PostHistoryTypeId = 10 AND NOT q.ClosedDate IS NULL
sede
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) ...
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_...
mimic_iii
CREATE TABLE table_1055 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Last match" text, "Replaced by" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the total number of date of vacancy for mann...
SELECT COUNT("Date of vacancy") FROM table_1055 WHERE "Manner of departure" = 'Resigned' AND "Outgoing manager" = 'Geninho'
wikisql
CREATE TABLE technician ( technician_id real, Name text, Team text, Starting_Year real, Age int ) CREATE TABLE repair ( repair_ID int, name text, Launch_Date text, Notes text ) CREATE TABLE machine ( Machine_ID int, Making_Year int, Class text, Team text, Machin...
SELECT Name, COUNT(Name) FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.Machine_ID = T2.Machine_ID JOIN technician AS T3 ON T1.technician_id = T3.technician_id GROUP BY Name ORDER BY COUNT(Name) DESC
nvbench
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC...
SELECT 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.JZZDSM = '矽肺(硅肺)I期' AND jyjgzbb.JCZBMC = '脂蛋白(a)二代' UNION SELECT jyjgzbb.CKZ...
css
CREATE TABLE table_54333 ( "Area" text, "Name" text, "Zone" text, "Group(s)" real, "Parties" real, "Max People" real, "Camp Type" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What zone has camp type D/S in area Bl9?
SELECT "Zone" FROM table_54333 WHERE "Camp Type" = 'd/s' AND "Area" = 'bl9'
wikisql
CREATE TABLE people ( people_id number, sex text, name text, date_of_birth text, height number, weight number ) CREATE TABLE candidate ( candidate_id number, people_id number, poll_source text, date text, support_rate number, consider_rate number, oppose_rate number,...
SELECT AVG(weight), MIN(weight), sex FROM people GROUP BY sex
spider
CREATE TABLE event ( Event_ID int, Date text, Venue text, Name text, Event_Attendance int ) CREATE TABLE journalist ( journalist_ID int, Name text, Nationality text, Age text, Years_working int ) CREATE TABLE news_report ( journalist_ID int, Event_ID int, Work_Type ...
SELECT Nationality, COUNT(Nationality) FROM journalist GROUP BY Nationality ORDER BY Nationality DESC
nvbench
CREATE TABLE table_69730 ( "Outcome" text, "Date" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the Outcome for the Partner of J rgen Melzer and the Date of January 7, 201...
SELECT "Outcome" FROM table_69730 WHERE "Partner" = 'jürgen melzer' AND "Date" = 'january 7, 2012'
wikisql
CREATE TABLE table_72237 ( "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. -- Name t...
SELECT COUNT("Team") FROM table_72237 WHERE "Location Attendance" = 'Philips Arena 19,335'
wikisql
CREATE TABLE table_24462 ( "Country" text, "Area (km\u00b2)" text, "Population (millions, 2011)" text, "GDP (PPP) (USD, per capita)" real, "GDP (nominal) (billions USD)" text, "HDI (2011)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is t...
SELECT "GDP (nominal) (billions USD)" FROM table_24462 WHERE "Population (millions, 2011)" = '3.4'
wikisql
CREATE TABLE table_203_853 ( id number, "date" text, "opponent" text, "home/away" text, "field" text, "result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many away games did the bridgeport barrage have ?
SELECT COUNT(*) FROM table_203_853 WHERE "home/away" = 'away'
squall
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 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_72209 ( "Series #" real, "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 title of the episode wit...
SELECT "Title" FROM table_72209 WHERE "Production code" = '624'
wikisql
CREATE TABLE table_60916 ( "Year" text, "Venue" text, "Winner" text, "Runner-up" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What winner has royal st george's golf club as the venue, and 1969 as the year?
SELECT "Winner" FROM table_60916 WHERE "Venue" = 'royal st george''s golf club' AND "Year" = '1969'
wikisql
CREATE TABLE table_62325 ( "Rank" real, "Name" text, "Season" text, "Club" text, "Goals" real, "Apps" real, "Goals per Match" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many ranks have 40 as the apps, with goals per match greater tha...
SELECT SUM("Rank") FROM table_62325 WHERE "Apps" = '40' AND "Goals per Match" > '1'
wikisql
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospit...
SELECT lab.labname FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-1634')) AND DATETIME(lab.labresulttime, 'start of month') = DATETIME(CURRENT_TIME(), ...
eicu
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.short_title = "Spinal canal explor NEC"
mimicsql_data
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemics...
SELECT AVG(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-8693')) AND lab.labname = 'ammonia' AND DATETIME(lab.labresulttime) >= DATETIM...
eicu
CREATE TABLE table_22639 ( "Years covered" text, "All bills sponsored" real, "All amendments sponsored" real, "All bills cosponsored" real, "All amendments cosponsored" real, "Bills originally cosponsored" real, "Amendments originally cosponsored" real ) -- Using valid SQLite, answer the f...
SELECT MAX("All bills sponsored") FROM table_22639
wikisql
CREATE TABLE table_74375 ( "Rank" real, "Rider" text, "Mon 30 May" text, "Tues 31 May" text, "Wed 1 June" text, "Thurs 2 June" text, "Fri 3 June" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the rider with a Fri 3 June time of 18' ...
SELECT "Rider" FROM table_74375 WHERE "Fri 3 June" = '18'' 19.68 123.516mph'
wikisql
CREATE TABLE table_16075179_6 ( date_of_appointment VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was the date of appointment for St. Johnstone's manager?
SELECT date_of_appointment FROM table_16075179_6 WHERE team = "St. Johnstone"
sql_create_context
CREATE TABLE table_80282 ( "Player" text, "Height" real, "Position" text, "Year born" real, "Current Club" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the height of the player who currently plays for Alta Gesti n Fuenlabrada?
SELECT "Height" FROM table_80282 WHERE "Current Club" = 'alta gestión fuenlabrada'
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Sarcoidosis" AND prescriptions.route = "NG"
mimicsql_data
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) 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, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2121" AND procedures.long_title = "Biopsy of tonsils and adenoids"
mimicsql_data
CREATE TABLE table_3045 ( "Seed" real, "Rank" real, "Player" text, "Points" real, "Points defending" real, "Points won" real, "New points" real, "Status" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the status of rank 20?
SELECT "Status" FROM table_3045 WHERE "Rank" = '20'
wikisql
CREATE TABLE table_name_38 ( score VARCHAR, location_attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score of the game at the Chicago Stadium?
SELECT score FROM table_name_38 WHERE location_attendance = "chicago stadium"
sql_create_context
CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE airline ( airline_code varc...
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 ((date_day.day_number = 27 AND date_day.month_number = 8 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_time...
atis
CREATE TABLE jobs ( job_id text, job_title text, min_salary number, max_salary number ) CREATE TABLE countries ( country_id text, country_name text, region_id number ) CREATE TABLE regions ( region_id number, region_name text ) CREATE TABLE locations ( location_id number, ...
SELECT T1.first_name, T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id
spider
CREATE TABLE table_name_18 ( dutch VARCHAR, english VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the dutch word for one?
SELECT dutch FROM table_name_18 WHERE english = "one"
sql_create_context
CREATE TABLE table_26375386_20 ( total VARCHAR, vote_percentage VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many times was the vote percentage 15.0%?
SELECT COUNT(total) FROM table_26375386_20 WHERE vote_percentage = "15.0%"
sql_create_context
CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, ...
SELECT p.Title, p.Id, u.DisplayName, u.Reputation FROM Posts AS p JOIN Users AS u ON p.OwnerUserId = u.Id WHERE p.CreationDate BETWEEN '2014-07-01' AND '2014-07-31' AND p.PostTypeId = 1 AND u.Reputation < 500
sede
CREATE TABLE Employee ( EmployeeId integer, LastName varchar(20), FirstName varchar(20), Title varchar(30), ReportsTo integer, BirthDate datetime, HireDate datetime, Address varchar(70), City varchar(40), State varchar(40), Country varchar(40), PostalCode varchar(10), ...
SELECT Phone, COUNT(Phone) FROM Employee GROUP BY Phone ORDER BY COUNT(Phone)
nvbench
CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Movie ( mID int, title text, year int, director text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Visua...
SELECT title, SUM(stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY title
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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd 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.long_title = "Migraine, unspecified, without mention of intractable migraine without mention of status migrainosus" AND lab.f...
mimicsql_data
CREATE TABLE table_49561 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score for the To par of +1?
SELECT "Score" FROM table_49561 WHERE "To par" = '+1'
wikisql
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT SUM(t_kc24.PER_ACC_PAY) FROM t_kc24 WHERE t_kc24.t_kc21_PERSON_NM = '邹兴国' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2000-06-10' AND '2005-08-21'
css
CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_proje...
SELECT COUNT(*) = 0 FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.has_exams = 'N' AND program_course.category LIKE '%ULCS%'
advising
CREATE TABLE table_46892 ( "Area" text, "Population" text, "% Muslim" text, "% Hindu" text, "% Buddhist" text, "% Other" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What area shows % Hindu of statistics from the bbc in depth report.?
SELECT "Area" FROM table_46892 WHERE "% Hindu" = 'statistics from the bbc in depth report.'
wikisql
CREATE TABLE table_name_11 ( venue VARCHAR, away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What venue featured collingwood as the away side?
SELECT venue FROM table_name_11 WHERE away_team = "collingwood"
sql_create_context
CREATE TABLE gas_station ( Station_ID int, Open_Year int, Location text, Manager_Name text, Vice_Manager_Name text, Representative_Name text ) CREATE TABLE station_company ( Station_ID int, Company_ID int, Rank_of_the_Year int ) CREATE TABLE company ( Company_ID int, Rank i...
SELECT Headquarters, COUNT(*) FROM company GROUP BY Headquarters ORDER BY COUNT(*)
nvbench
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 zyb WHERE zyb.PERSON_NM = '04297841' AND MOD(zyb.MED_CLINIC_ID, 1) = 0
css
CREATE TABLE table_3583 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the name o...
SELECT "Title" FROM table_3583 WHERE "No. in season" = '5'
wikisql
CREATE TABLE table_206359_1 ( shareholder_name VARCHAR, _percentage_of_capital VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many different shareholders have 2.39 % of capital?
SELECT COUNT(shareholder_name) FROM table_206359_1 WHERE _percentage_of_capital = "2.39"
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 AVG(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.ethnicity = "WHITE"
mimicsql_data
CREATE TABLE table_26250227_1 ( order__number VARCHAR, original_artist VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are all of the order # where authentic artist is maroon 5
SELECT order__number FROM table_26250227_1 WHERE original_artist = "Maroon 5"
sql_create_context
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid numb...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', medication.drugstarttime)) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-38...
eicu
CREATE TABLE table_name_4 ( wins VARCHAR, losses VARCHAR, goals_for VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of wins when the goals for number was bigger than 35, the team was the Montreal Hockey Club, and the numb...
SELECT COUNT(wins) FROM table_name_4 WHERE goals_for > 35 AND team = "montreal hockey club" AND losses < 2
sql_create_context
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 * 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_MZJZJLB AND zyjybgb.YLJGDM = jyjgzb...
css
CREATE TABLE table_73439 ( "Conference" text, "Regular Season Winner" text, "Conference Player of the Year" text, "Conference Tournament" text, "Tournament Venue (City)" text, "Tournament Winner" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Wh...
SELECT "Conference Tournament" FROM table_73439 WHERE "Regular Season Winner" = 'Idaho State'
wikisql
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellv...
SELECT patient.hospitaldischargetime FROM patient WHERE patient.uniquepid = '010-26737' AND DATETIME(patient.hospitaldischargetime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY patient.hospitaldischargetime LIMIT 1
eicu
CREATE TABLE Apartment_Facilities ( apt_id INTEGER, facility_code CHAR(15) ) CREATE TABLE View_Unit_Status ( apt_id INTEGER, apt_booking_id INTEGER, status_date DATETIME, available_yn BIT ) CREATE TABLE Guests ( guest_id INTEGER, gender_code CHAR(1), guest_first_name VARCHAR(80), ...
SELECT apt_number, room_count FROM Apartments ORDER BY room_count
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 demographic.age, prescriptions.route FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "2560"
mimicsql_data
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 gwyjzb.IN_DIAG_DIS_NM, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '4327288' GROUP BY gwyjzb.IN_DIAG_DIS_NM UNION SELECT fgwyjzb.IN_DIAG_DIS_NM, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '4327288' GROUP BY fgwyjzb.IN_DIAG_DIS_NM
css
CREATE TABLE table_22597626_17 ( year INTEGER, opponents_in_the_final VARCHAR, score_in_the_final VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the year date when one of the opponents in the final was bahrami leconte and score in the final is 7...
SELECT MIN(year) FROM table_22597626_17 WHERE opponents_in_the_final = "Bahrami Leconte" AND score_in_the_final = "7–6 2 , 6–1"
sql_create_context
CREATE TABLE person_info_hz_info ( RYBH text, KH number, KLX number, YLJGDM number ) CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text ) CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZ...
SELECT jybgb.BGDH FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND person_info_hz_info.KH = hz_info.KH AND pers...
css
CREATE TABLE table_2468961_8 ( written_by VARCHAR, directed_by VARCHAR, original_air_date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name who wrote the episode directed by patrick duffy airing on november 7, 1997
SELECT written_by FROM table_2468961_8 WHERE directed_by = "Patrick Duffy" AND original_air_date = "November 7, 1997"
sql_create_context
CREATE TABLE table_name_85 ( live_births VARCHAR, migration VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What kind of Live births has a Migration of -14 873?
SELECT live_births FROM table_name_85 WHERE migration = "-14 873"
sql_create_context
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ...
SELECT * FROM (SELECT p.OwnerUserId AS "user_link", COUNT(*) AS "Favorite questions" FROM Votes AS v INNER JOIN Posts AS p ON p.Id = v.PostId WHERE UserId = '##UserId##' AND VoteTypeId = 5 GROUP BY p.OwnerUserId) AS I ORDER BY 'Favorite questions' DESC
sede
CREATE TABLE table_5478 ( "Rank" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many bronze medals are there when there are fewer than 3 silver medals and 7 medals total?
SELECT "Bronze" FROM table_5478 WHERE "Silver" < '3' AND "Total" = '7'
wikisql
CREATE TABLE mzjzjlb_jybgb ( YLJGDM_MZJZJLB text, BGDH number, YLJGDM number ) CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, ...
SELECT jybgb.BGDH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb 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 mzjzjl...
css
CREATE TABLE table_name_50 ( h___a VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the H/A of the game on 24 january 2009?
SELECT h___a FROM table_name_50 WHERE date = "24 january 2009"
sql_create_context
CREATE TABLE table_8483 ( "School" text, "Locality" text, "Ages" text, "Capacity" real, "Ofsted" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Ofsted has a Capacity smaller than 56, and Ages of 11-16?
SELECT SUM("Ofsted") FROM table_8483 WHERE "Capacity" < '56' AND "Ages" = '11-16'
wikisql
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 employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL v...
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(SALARY)
nvbench
CREATE TABLE table_22536 ( "Position" text, "Country" text, "Floor" text, "Pommel Horse" text, "Rings" text, "Vault" text, "Parallel Bars" text, "Horizontal Bar" text, "Team Total" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- If th...
SELECT "Horizontal Bar" FROM table_22536 WHERE "Rings" = '58.975'
wikisql
CREATE TABLE review ( rid int, business_id varchar, user_id varchar, rating float, text longtext, year int, month varchar ) CREATE TABLE business ( bid int, business_id varchar, name varchar, full_address varchar, city varchar, latitude varchar, longitude varchar...
SELECT COUNT(DISTINCT (text)), month FROM tip GROUP BY month
yelp
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'pericardiocentesis') ...
mimic_iii
CREATE TABLE table_name_20 ( date VARCHAR, nationality VARCHAR, games VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On what date were the 1997 Bridgetown games in which a Martinique girl competed?
SELECT date FROM table_name_20 WHERE nationality = "martinique" AND games = "1997 bridgetown"
sql_create_context
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
SELECT MZZYZDZZBM FROM zyjzjlb WHERE JZLSH = '90470855846'
css
CREATE TABLE table_11562149_1 ( no_in_series VARCHAR, featured_character_s_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the episode numbers where the episode features Jack & Locke?
SELECT no_in_series FROM table_11562149_1 WHERE featured_character_s_ = "Jack & Locke"
sql_create_context
CREATE TABLE races ( raceid number, year number, round number, circuitid number, name text, date text, time text, url text ) CREATE TABLE qualifying ( qualifyid number, raceid number, driverid number, constructorid number, number number, position number, q1 t...
SELECT DISTINCT forename FROM drivers ORDER BY forename
spider
CREATE TABLE table_name_26 ( runner_up VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who won the runner-up in 1999?
SELECT runner_up FROM table_name_26 WHERE year = 1999
sql_create_context
CREATE TABLE table_74493 ( "Year" text, "Competition" text, "Opponent" text, "Score" text, "Venue" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- At what venue did the team from Collingwood score 7.14 (56) - 4.5 (29)?
SELECT "Venue" FROM table_74493 WHERE "Opponent" = 'collingwood' AND "Score" = '7.14 (56) - 4.5 (29)'
wikisql
CREATE TABLE table_16587 ( "#" real, "Episode" text, "Air Date" text, "Timeslot (EST)" text, "Season" text, "Rating" text, "Share" real, "18\u201349" text, "Viewers (m)" text, "Rank (#)" text ) -- Using valid SQLite, answer the following questions for the tables provided above....
SELECT "Rank (#)" FROM table_16587 WHERE "Air Date" = 'October 26, 2007'
wikisql
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, a...
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME(), '-6 year') GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 4
eicu