instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_name_8 ( saturday VARCHAR, thursday VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Saturday has a Thursday of mokuy bi
SELECT saturday FROM table_name_8 WHERE thursday = "木曜日 mokuyōbi"
sql_create_context
CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT ) CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, e...
SELECT date, COUNT(date) FROM weather
nvbench
CREATE TABLE table_8744 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On what date was the opponent the Miami Dolphins?
SELECT "Date" FROM table_8744 WHERE "Opponent" = 'miami dolphins'
wikisql
CREATE TABLE table_name_53 ( reaction INTEGER, heat VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average reaction for brigitte foster-hylton after heat 1?
SELECT AVG(reaction) FROM table_name_53 WHERE heat > 1 AND name = "brigitte foster-hylton"
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.icd9_code = "6826"
mimicsql_data
CREATE TABLE table_16258 ( "Rnd" text, "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. -- wha...
SELECT "Race Name" FROM table_16258 WHERE "Winning team" = 'Newman/Haas Racing' AND "Pole position" = 'Rick Mears'
wikisql
CREATE TABLE table_23382 ( "Rank" real, "Dismissals" real, "Player" text, "Caught" real, "Stumped" real, "Matches" real, "Innings" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the rank of adam gilchrist
SELECT COUNT("Rank") FROM table_23382 WHERE "Player" = 'Adam Gilchrist'
wikisql
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, v...
SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20862)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label...
mimic_iii
CREATE TABLE table_60260 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the Player which has a To par of 6?
SELECT "Player" FROM table_60260 WHERE "To par" = '–6'
wikisql
CREATE TABLE table_2551 ( "Season" text, "Player" text, "Nationality" text, "Team" text, "Points" real, "Average" text, "Played" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many games were played by the player with 927 points?
SELECT "Played" FROM table_2551 WHERE "Points" = '927'
wikisql
CREATE TABLE table_name_43 ( crowd INTEGER, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many people were in attendance at Glenferrie Oval?
SELECT MIN(crowd) FROM table_name_43 WHERE venue = "glenferrie oval"
sql_create_context
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) 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, C...
SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '9320875' AND t_kc21.IN_HOSP_DATE BETWEEN '2006-03-27' AND '2018-07-19' AND t_kc21.CLINIC_TYPE = '购药'
css
CREATE TABLE table_39978 ( "Species" text, "Indole" text, "Methyl Red" text, "Voges-Proskauer" text, "Citrate" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Voges-Proskauer reading for proteus mirabilis?
SELECT "Voges-Proskauer" FROM table_39978 WHERE "Species" = 'proteus mirabilis'
wikisql
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_procedures ( row_id number, ...
SELECT patients.gender FROM patients WHERE patients.subject_id = 12775
mimic_iii
CREATE TABLE table_204_140 ( id number, "round" number, "#" number, "player" text, "position" text, "nationality" text, "college/junior/club team (league)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- are there more players from sweden or ...
SELECT "nationality" FROM table_204_140 WHERE "nationality" IN ('sweden', 'canada') GROUP BY "nationality" ORDER BY COUNT("player") DESC LIMIT 1
squall
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodi...
SELECT t1.drugname FROM (SELECT medication.drugname, COUNT(medication.drugstarttime) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030...
eicu
CREATE TABLE table_name_72 ( seats VARCHAR, election VARCHAR, share_of_votes VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many seats did the election before 2004 with 3.4% share of votes have?
SELECT seats FROM table_name_72 WHERE election < 2004 AND share_of_votes = "3.4%"
sql_create_context
CREATE TABLE table_42616 ( "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 is the total of wins when the evens is less than 3?
SELECT SUM("Wins") FROM table_42616 WHERE "Events" < '3'
wikisql
CREATE TABLE table_68248 ( "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 average bronze medals of Uganda's swimmers when they earned over 2 medals?
SELECT AVG("Bronze") FROM table_68248 WHERE "Nation" = 'uganda' AND "Total" > '2'
wikisql
CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT t_kc21.OUT_DIAG_DIS_CD, t_kc21.OUT_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_ID = '07451583' AND t_kc21.MED_SER_ORG_NO = '6810321' AND t_kc21.OUT_DIAG_DOC_NM LIKE '钱%'
css
CREATE TABLE table_name_36 ( agg VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the 1st leg score for the team with an Agg score of 151-134?
SELECT 1 AS st_leg FROM table_name_36 WHERE agg = "151-134"
sql_create_context
CREATE TABLE table_name_65 ( title VARCHAR, producer VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the title of the film when the producer was 2003?
SELECT title FROM table_name_65 WHERE producer = "2003"
sql_create_context
CREATE TABLE table_name_57 ( money___ INTEGER, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Money ($) of the game with a score of 69-74-70-73=286?
SELECT MAX(money___) AS $__ FROM table_name_57 WHERE score = 69 - 74 - 70 - 73 = 286
sql_create_context
CREATE TABLE table_3985 ( "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 title when the ...
SELECT "Title" FROM table_3985 WHERE "Directed by" = 'Maynard C. Virgil I'
wikisql
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 stadium ( ID int, name text, Capacity int, City text, Coun...
SELECT Nationality, AVG(meter_100) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC
nvbench
CREATE TABLE table_name_80 ( segment_a VARCHAR, segment_d VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which segment A item that has a Segment D of wigs?
SELECT segment_a FROM table_name_80 WHERE segment_d = "wigs"
sql_create_context
CREATE TABLE table_18646111_13 ( round_1 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the 1/8 finals for round 1 n/a
SELECT 1 AS _8_finals FROM table_18646111_13 WHERE round_1 = "N/A"
sql_create_context
CREATE TABLE Acceptance ( Submission_ID int, Workshop_ID int, Result text ) CREATE TABLE workshop ( Workshop_ID int, Date text, Venue text, Name text ) CREATE TABLE submission ( Submission_ID int, Scores real, Author text, College text ) -- Using valid SQLite, answer the ...
SELECT Result, COUNT(Result) FROM Acceptance GROUP BY Result
nvbench
CREATE TABLE table_47116 ( "Game" real, "3PM-A" text, "Percent Made" real, "Total Made" real, "Total Attempted" real, "Series Percent" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the total attempted with a total made 16
SELECT COUNT("Total Attempted") FROM table_47116 WHERE "Total Made" = '16'
wikisql
CREATE TABLE physician ( employeeid number, name text, position text, ssn number ) CREATE TABLE room ( roomnumber number, roomtype text, blockfloor number, blockcode number, unavailable boolean ) CREATE TABLE block ( blockfloor number, blockcode number ) CREATE TABLE affil...
SELECT patient FROM undergoes ORDER BY dateundergoes LIMIT 1
spider
CREATE TABLE table_46415 ( "Year" real, "Award" text, "Category" text, "Nominee" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was nominated for Best Theatre Choreographer?
SELECT "Nominee" FROM table_46415 WHERE "Category" = 'best theatre choreographer'
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 t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '喻秀敏' AND t_kc22.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT > 8393.94)
css
CREATE TABLE table_62100 ( "Name" text, "Confederation" text, "International goals" real, "Caps" real, "Goals per Match" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many caps does Jon Dahl Tomasson, who has less than 0.46 goals per match, hav...
SELECT COUNT("Caps") FROM table_62100 WHERE "Name" = 'jon dahl tomasson' AND "Goals per Match" < '0.46'
wikisql
CREATE TABLE table_12570207_1 ( livingstone VARCHAR, fitzroy VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what's the livingstone with fitzroy being 9499
SELECT livingstone FROM table_12570207_1 WHERE fitzroy = 9499
sql_create_context
CREATE TABLE teaches ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0) ) CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varchar(20), tot_cred numeric(3,0) ) CREATE TABLE section ( course_id varchar(8), sec_id...
SELECT year, COUNT(*) FROM section GROUP BY year ORDER BY year DESC
nvbench
CREATE TABLE table_20428 ( "Episode Number" real, "Air Date" text, "Guest Host" text, "Musical Guest (Song performed)" text, "Who knows the most about the guest host? Panelists" text, "Coat Of Cash Wearing Celebrity" text ) -- Using valid SQLite, answer the following questions for the tables p...
SELECT "Musical Guest (Song performed)" FROM table_20428 WHERE "Guest Host" = 'Barbara Windsor'
wikisql
CREATE TABLE table_name_83 ( circuit VARCHAR, fastest_lap VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the circuit for alberto ascari jos froil n gonz lez?
SELECT circuit FROM table_name_83 WHERE fastest_lap = "alberto ascari josé froilán gonzález"
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 demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "SEPSIS" AND demographic.admityear < "2203"
mimicsql_data
CREATE TABLE table_13096 ( "Place" real, "Team" text, "Played" real, "Draw" real, "Lost" real, "Goals Scored" real, "Goals Conceded" real, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total points for a place less ...
SELECT SUM("Points") FROM table_13096 WHERE "Place" < '2' AND "Played" > '18'
wikisql
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT qtb.OUT_DIAG_DIS_CD, qtb.OUT_DIAG_DIS_NM FROM qtb WHERE qtb.PERSON_NM = '章恺乐' AND qtb.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 3006.5) UNION SELECT gyb.OUT_DIAG_DIS_CD, gyb.OUT_DIAG_DIS_NM FROM gyb WHERE gyb.PERSON_NM = '章恺乐' AND gyb.MED_CLINIC_ID IN (SELECT t_kc24.MED_C...
css
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, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, ...
SELECT jybgb.BGRGH, jybgb.BGRXM FROM jybgb WHERE jybgb.JZLSH = '62628580577' GROUP BY jybgb.BGRGH HAVING COUNT(*) > 4
css
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, ic...
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 = 'famotidine (pf)' AND DATETIME(medication.drugstartt...
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 demographic.dob, diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Jerry Deberry"
mimicsql_data
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "RASH" AND demographic.dod_year <= "2155.0"
mimicsql_data
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 diagnoses ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "BLACK/HAITIAN" AND lab.itemid = "50904"
mimicsql_data
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title te...
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, 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_...
mimic_iii
CREATE TABLE train ( id int, train_number int, name text, origin text, destination text, time text, interval text ) CREATE TABLE station ( id int, network_name text, services text, local_authority text ) CREATE TABLE route ( train_id int, station_id int ) CREATE TA...
SELECT local_authority, id FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id ORDER BY id
nvbench
CREATE TABLE table_name_88 ( population VARCHAR, _number_of_phones_as__percentage_of_population VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many people live where there are 118% of people have phones?
SELECT population FROM table_name_88 WHERE _number_of_phones_as__percentage_of_population = 118
sql_create_context
CREATE TABLE table_name_74 ( crowd INTEGER, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the largest attendance at kardinia park?
SELECT MAX(crowd) FROM table_name_74 WHERE venue = "kardinia park"
sql_create_context
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Comments ( Id number, PostId number, ...
WITH PostScores AS (SELECT p.ViewCount, p.PostTypeId, COUNT(*) * 1.0 AS PostCount FROM Posts AS p WHERE p.PostTypeId IN (1) AND ClosedDate IS NULL AND DATEDIFF(day, p.CreationDate, GETDATE()) > '##minAge:int?7##' GROUP BY ViewCount, p.PostTypeId) SELECT ViewCount, CASE WHEN PostTypeId = '1' THEN 'Questions' ELSE 'Answe...
sede
CREATE TABLE table_name_79 ( date VARCHAR, result VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On what date was the result Eng by 1 wkt?
SELECT date FROM table_name_79 WHERE result = "eng by 1 wkt"
sql_create_context
CREATE TABLE table_203_750 ( id number, "#" number, "date" text, "venue" text, "opponent" text, "score" text, "result" text, "competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- for each winning game , what was their score ?
SELECT "score" FROM table_203_750 WHERE "result" = 'win'
squall
CREATE TABLE table_70405 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many years did barclay nordica arrows bmw enter with a bmw str-4 t/c engine with less than 1 point?
SELECT SUM("Year") FROM table_70405 WHERE "Engine" = 'bmw str-4 t/c' AND "Entrant" = 'barclay nordica arrows bmw' AND "Points" < '1'
wikisql
CREATE TABLE table_52232 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the date of the Capitals game when Columbus was the home ...
SELECT "Date" FROM table_52232 WHERE "Home" = 'columbus'
wikisql
CREATE TABLE roller_coaster ( Country_ID VARCHAR, Height VARCHAR ) CREATE TABLE country ( Name VARCHAR, population VARCHAR, Country_ID VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show the name and population of the country that has the highes...
SELECT T1.Name, T1.population FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID ORDER BY T2.Height DESC LIMIT 1
sql_create_context
CREATE TABLE table_name_72 ( date VARCHAR, result VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When did the w 20-19 happen?
SELECT date FROM table_name_72 WHERE result = "w 20-19"
sql_create_context
CREATE TABLE classroom ( building varchar(15), room_number varchar(7), capacity numeric(4,0) ) CREATE TABLE instructor ( ID varchar(5), name varchar(20), dept_name varchar(20), salary numeric(8,2) ) CREATE TABLE section ( course_id varchar(8), sec_id varchar(8), semester varcha...
SELECT T1.dept_name, COUNT(DISTINCT T3.ID) FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name ORDER BY T1.dept_name
nvbench
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 COUNT(*) > 0 FROM course, course_offering, semester WHERE (course.description LIKE '%lab%' OR course.name LIKE '%lab%') AND (course.description LIKE '%Scientific Writing%' OR course.name LIKE '%Scientific Writing%') AND course.course_id = course_offering.course_id AND semester.semester_id = course_offering.semes...
advising
CREATE TABLE table_8902 ( "Consonant final stem" text, "Example: did-" text, "Vowel final stem" text, "Example: ch'aghara-" text, "Noun example: datv-" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What example for did- is shown for a Consonant fin...
SELECT "Example: did-" FROM table_8902 WHERE "Consonant final stem" = '-i' AND "Noun example: datv-" = 'datv-it'
wikisql
CREATE TABLE table_79972 ( "Rank" real, "Mine" text, "County" text, "Operator" text, "Source of copper" text, "2012 Cu Production (lbs)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the lowest ranking source of copper, copper ore, conce...
SELECT MIN("Rank") FROM table_79972 WHERE "Source of copper" = 'copper ore, concentrated and leached'
wikisql
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0),...
SELECT LAST_NAME, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
nvbench
CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT t_kc21.IN_DIAG_DIS_CD, t_kc21.IN_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_ID = '55178621' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 9322.98)
css
CREATE TABLE table_65594 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Outcome of the Match played after 2003 with a S...
SELECT "Outcome" FROM table_65594 WHERE "Year" > '2003' AND "Score" = '6–0, 6–3'
wikisql
CREATE TABLE table_7249 ( "Week #" text, "Theme" text, "Song choice" text, "Original artist" text, "Order #" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Original artist when the week number is top 9?
SELECT "Original artist" FROM table_7249 WHERE "Week #" = 'top 9'
wikisql
CREATE TABLE table_203_494 ( id number, "party" text, "votes" number, "%" number, "swing" number, "seats" number, "change" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- the nationals sa and independent party make up what percentage of vot...
SELECT SUM("%") FROM table_203_494 WHERE "party" IN ('nationals sa', 'independent')
squall
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE cost ( row_id...
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 77676) AND DATETIME(procedures_icd.charttime) <= DATETIME(CURRENT_TIME(), '-1 year')
mimic_iii
CREATE TABLE Documents_with_Expenses ( Document_ID INTEGER, Budget_Type_Code CHAR(15), Document_Details VARCHAR(255) ) CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15), Document_Type_Name VARCHAR(255), Document_Type_Description VARCHAR(255) ) CREATE TABLE Projects ( Project_ID...
SELECT Budget_Type_Code, COUNT(*) FROM Documents_with_Expenses GROUP BY Budget_Type_Code ORDER BY COUNT(*)
nvbench
CREATE TABLE Order_Items ( order_item_id INTEGER, order_id INTEGER, product_id INTEGER, product_quantity VARCHAR(50), other_order_item_details VARCHAR(255) ) CREATE TABLE Invoice_Line_Items ( order_item_id INTEGER, invoice_number INTEGER, product_id INTEGER, product_title VARCHAR(80...
SELECT date_account_opened, COUNT(date_account_opened) FROM Accounts ORDER BY date_account_opened
nvbench
CREATE TABLE table_25366 ( "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. -- On wha...
SELECT "Date" FROM table_25366 WHERE "Team" = '@ Toronto'
wikisql
CREATE TABLE table_15439 ( "Riding" text, "Province" text, "Candidate" text, "Votes" real, "Placement" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Placement when the Votes are fewer than 208, and when the Candidate is Jordan Turner?
SELECT "Placement" FROM table_15439 WHERE "Votes" < '208' AND "Candidate" = 'jordan turner'
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 * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb 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 jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb....
css
CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TE...
SELECT Grape, COUNT(Grape) FROM wine GROUP BY Grape ORDER BY Grape DESC
nvbench
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABL...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 436...
mimic_iii
CREATE TABLE table_name_60 ( total_fat VARCHAR, polyunsaturated_fat VARCHAR, monounsaturated_fat VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the total fat which has a polyunsaturated fat of 11g and monounsaturated fat of 45g
SELECT total_fat FROM table_name_60 WHERE polyunsaturated_fat = "11g" AND monounsaturated_fat = "45g"
sql_create_context
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following questions for the...
SELECT T2.Name, COUNT(*) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name
nvbench
CREATE TABLE table_name_18 ( score VARCHAR, february VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what score was on february 21
SELECT score FROM table_name_18 WHERE february = 21
sql_create_context
CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int ) CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text ) -- Using valid SQLite, answer the following questions fo...
SELECT Fate, COUNT(Fate) FROM mission GROUP BY Fate ORDER BY COUNT(Fate) DESC
nvbench
CREATE TABLE table_55823 ( "Year" real, "Championship" text, "54 holes" text, "Winning score" text, "Margin" text, "Runner(s)-up" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the margin for the Masters Tournament (2) championship?
SELECT "Margin" FROM table_55823 WHERE "Championship" = 'masters tournament (2)'
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 prescriptions.drug_type FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.name = "Kelly Gallardo"
mimicsql_data
CREATE TABLE table_1139835_1 ( crowd INTEGER, scores VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the crowd when the scores are 10.12 (72) 8.11 (59)?
SELECT MAX(crowd) FROM table_1139835_1 WHERE scores = "10.12 (72) – 8.11 (59)"
sql_create_context
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) 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, JO...
SELECT HIRE_DATE, AVG(SALARY) FROM employees
nvbench
CREATE TABLE table_70933 ( "Team" text, "Manager 1" text, "Captain" text, "Kit manufacturer" text, "Shirt sponsor" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the team captain of the Bolton Wanderers?
SELECT "Captain" FROM table_70933 WHERE "Team" = 'bolton wanderers'
wikisql
CREATE TABLE table_17740 ( "Team" text, "Car(s)" text, "#" real, "Driver(s)" text, "Primary Sponsor(s)" text, "Owner(s)" text, "Crew Chief" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the driver for the team whose primary sponsor ...
SELECT "Driver(s)" FROM table_17740 WHERE "Primary Sponsor(s)" = 'Quicken Loans / Haas Automation'
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 txmzjzjlb.JZZDBM, txmzjzjlb.JZZDSM 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 person_info.XM = '花志专' UNION SELECT ftxmzjzjlb.JZZDBM, ftxmzjzjlb.JZZDSM FROM person_info JO...
css
CREATE TABLE table_44791 ( "Date" text, "Home team" text, "Score" text, "Away team" text, "Venue" text, "Box Score" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What kind of report was for the game played on 29 November with...
SELECT "Report" FROM table_44791 WHERE "Date" = '29 november' AND "Away team" = 'melbourne tigers'
wikisql
CREATE TABLE table_name_97 ( adelaide VARCHAR, gold_coast VARCHAR, auckland VARCHAR, melbourne VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- yes or no for the adelaide with no for auckland, yes for melbourne, yes for the gold coast?
SELECT adelaide FROM table_name_97 WHERE auckland = "no" AND melbourne = "yes" AND gold_coast = "yes"
sql_create_context
CREATE TABLE table_14697 ( "Rank" real, "Heat" real, "Lane" real, "Name" text, "Nationality" text, "Time" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the top rank with a time of 2:19.86?
SELECT MAX("Rank") FROM table_14697 WHERE "Time" = '2:19.86'
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.short_title = "Open reduc-int fix femur"
mimicsql_data
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) 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...
SELECT JOB_ID, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY DEPARTMENT_ID
nvbench
CREATE TABLE table_56138 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Venue has an Away team score of 13.12 (90)...
SELECT "Venue" FROM table_56138 WHERE "Away team score" = '13.12 (90)'
wikisql
CREATE TABLE table_name_92 ( driver VARCHAR, laps VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which driver has 45 laps?
SELECT driver FROM table_name_92 WHERE laps = 45
sql_create_context
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, ...
SELECT DisplayName, COUNT(DisplayName) AS N FROM Users GROUP BY DisplayName ORDER BY N DESC LIMIT 100
sede
CREATE TABLE table_54476 ( "National team" text, "Club" text, "Season" text, "Apps" real, "Goals" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In the 2010 season what club has 0 goals and more than 0 Apps?
SELECT "Club" FROM table_54476 WHERE "Goals" = '0' AND "Apps" > '0' AND "Season" = '2010'
wikisql
CREATE TABLE table_11996 ( "Date" text, "Round" text, "Attendance" text, "Opposition" text, "Stadium" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who's the opposition at westpac stadium when the attendance is 31,853?
SELECT "Opposition" FROM table_11996 WHERE "Stadium" = 'westpac stadium' AND "Attendance" = '31,853'
wikisql
CREATE TABLE table_53940 ( "Position" real, "Club" text, "Played" real, "Points" text, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real ) -- Using valid SQLite, answer the following questions for the tables provided above....
SELECT SUM("Draws") FROM table_53940 WHERE "Position" < '15' AND "Played" > '38'
wikisql
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "HOME HEALTH CARE" AND procedures.long_title = "Percutaneous abdominal drainage"
mimicsql_data
CREATE TABLE table_13952 ( "Date" text, "Tournament" text, "Surface" text, "Opponent in the final" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the score for the tournament cagnes-sur-mer?
SELECT "Score" FROM table_13952 WHERE "Tournament" = 'cagnes-sur-mer'
wikisql
CREATE TABLE Procedures ( Code INTEGER, Name VARCHAR(30), Cost REAL ) CREATE TABLE Nurse ( EmployeeID INTEGER, Name VARCHAR(30), Position VARCHAR(30), Registered BOOLEAN, SSN INTEGER ) CREATE TABLE Undergoes ( Patient INTEGER, Procedures INTEGER, Stay INTEGER, DateUnder...
SELECT Name, COUNT(Name) FROM Appointment AS T1 JOIN Physician AS T2 ON T1.Physician = T2.EmployeeID GROUP BY Name ORDER BY Name DESC
nvbench
CREATE TABLE table_name_88 ( to_par INTEGER, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Robert Allenby's average to par score?
SELECT AVG(to_par) FROM table_name_88 WHERE player = "robert allenby"
sql_create_context
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, ...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, Location FROM Users WHERE LOWER(Location) LIKE '%oh%' OR LOWER(Location) LIKE '%ohio%' ORDER BY Reputation DESC LIMIT 200
sede