instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_name_72 ( class VARCHAR, year VARCHAR, chassis VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which class has a year prior to 2011 and audi r15 tdi as the chassis?
SELECT class FROM table_name_72 WHERE year < 2011 AND chassis = "audi r15 tdi"
sql_create_context
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TA...
SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime, t1.patienthealthsystemstayid FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = ...
eicu
CREATE TABLE table_65019 ( "District" text, "Number of Households" real, "Total Population" real, "Male" real, "Female" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of females where the total population is less than 2,195?...
SELECT COUNT("Female") FROM table_65019 WHERE "Total Population" < '2,195'
wikisql
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 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2139" AND lab.itemid = "50911"
mimicsql_data
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.discharge_location = "HOME HEALTH CARE" AND lab.label = "Amylase"
mimicsql_data
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "SEPSIS" AND procedures.short_title = "Abdomen artery incision"
mimicsql_data
CREATE TABLE table_76395 ( "Year (Ceremony)" text, "Film title used in nomination" text, "Original title" text, "Language(s)" text, "Director" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was Zona Sur's result after being c...
SELECT "Result" FROM table_76395 WHERE "Original title" = 'zona sur'
wikisql
CREATE TABLE table_48060 ( "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 method when the time is 5:00, and the r...
SELECT "Method" FROM table_48060 WHERE "Time" = '5:00' AND "Record" = '14–6–1'
wikisql
CREATE TABLE table_45135 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What event had a tko (punches) method and jason macdonald as the opp...
SELECT "Event" FROM table_45135 WHERE "Method" = 'tko (punches)' AND "Opponent" = 'jason macdonald'
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_kc22.AMOUNT) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '姜舒方' AND t_kc21.CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2005-02-06' AND '2017-08-25' AND t_kc22.MED_INV_ITEM_TYPE = '手术费'
css
CREATE TABLE table_74150 ( "Institution" text, "Team" text, "City" text, "Province" text, "Founded" real, "Affiliation" text, "Enrollment" real, "Endowment" text, "Football stadium" text, "Capacity" real ) -- Using valid SQLite, answer the following questions for the tables pro...
SELECT "Institution" FROM table_74150 WHERE "Endowment" = '$25.9M'
wikisql
CREATE TABLE table_30930 ( "No. overall" real, "No. for series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "UK viewers (million)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date did 'the eye...
SELECT "Original air date" FROM table_30930 WHERE "Title" = 'The Eye of the Phoenix'
wikisql
CREATE TABLE table_74133 ( "Game" real, "November" real, "Opponent" text, "Score" text, "Location/Attendance" text, "Record" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is every record for game 13?
SELECT "Record" FROM table_74133 WHERE "Game" = '13'
wikisql
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "WHITE" AND demographic.dob_year < "2103"
mimicsql_data
CREATE TABLE table_1341423_35 ( incumbent VARCHAR, first_elected VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was elected in 1972
SELECT incumbent FROM table_1341423_35 WHERE first_elected = 1972
sql_create_context
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), guest_last_name VARCHAR(80), date_of_birth DATETIME ) CREATE TABLE Apartments ...
SELECT apt_type_code, MIN(room_count) FROM Apartments GROUP BY apt_type_code ORDER BY apt_type_code
nvbench
CREATE TABLE table_name_46 ( score VARCHAR, opponent_in_the_final VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the score for opponent in the final being paul baccanello
SELECT score FROM table_name_46 WHERE opponent_in_the_final = "paul baccanello"
sql_create_context
CREATE TABLE table_2009095_2 ( surface VARCHAR, championship VARCHAR, outcome VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the surface for australian open for winner
SELECT surface FROM table_2009095_2 WHERE championship = "Australian Open" AND outcome = "Winner"
sql_create_context
CREATE TABLE ship ( ship_id number, name text, type text, nationality text, tonnage number ) CREATE TABLE mission ( mission_id number, ship_id number, code text, launched_year number, location text, speed_knots number, fate text ) -- Using valid SQLite, answer the foll...
SELECT T2.name FROM mission AS T1 JOIN ship AS T2 ON T1.ship_id = T2.ship_id WHERE T1.launched_year > 1928
spider
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 WHERE demographic.dob_year < "2107" AND diagnoses.short_title = "Elev transaminase/ldh"
mimicsql_data
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDi...
SELECT TagName, COUNT(*) AS UpVotes FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Votes ON Votes.PostId = Posts.Id AND VoteTypeId = 2 WHERE Posts.OwnerUserId = @UserId GROUP BY TagName ORDER BY UpVotes DESC
sede
CREATE TABLE products ( product_id number, color_code text, product_category_code text, product_name text, typical_buying_price text, typical_selling_price text, product_description text, other_product_details text ) CREATE TABLE ref_colors ( color_code text, color_description t...
SELECT t3.characteristic_name, t3.characteristic_data_type FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN characteristics AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "cumin"
spider
CREATE TABLE table_name_35 ( score VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Score with a Team with @ houston?
SELECT score FROM table_name_35 WHERE team = "@ houston"
sql_create_context
CREATE TABLE regions ( region_id number, region_name text ) CREATE TABLE employees ( employee_id number, first_name text, last_name text, email text, phone_number text, hire_date time, job_id text, salary number, commission_pct number, manager_id number, department_i...
SELECT * FROM employees WHERE NOT department_id IN (SELECT department_id FROM departments WHERE manager_id BETWEEN 100 AND 200)
spider
CREATE TABLE table_45429 ( "Player" text, "Nationality" text, "Jersey Number(s)" text, "Position" text, "Years" text, "From" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- During what years was the Jersey Numbers 34, 30 played?
SELECT "Years" FROM table_45429 WHERE "Jersey Number(s)" = '34, 30'
wikisql
CREATE TABLE table_name_62 ( agricultural_panel INTEGER, total VARCHAR, labour_panel VARCHAR, nominated_by_the_taoiseach VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average agricultural panel of the composition with a labour panel less...
SELECT AVG(agricultural_panel) FROM table_name_62 WHERE labour_panel < 6 AND nominated_by_the_taoiseach > 0 AND total < 4
sql_create_context
CREATE TABLE table_35573 ( "Position" real, "Pilot" text, "Glider" text, "Speed" text, "Distance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which pilot has a position above 5 and a speed of 118.8km/h?
SELECT "Pilot" FROM table_35573 WHERE "Position" > '5' AND "Speed" = '118.8km/h'
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 zyjzjlb.JZLSH FROM person_info JOIN hz_info JOIN zyjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE person_info.XM = '李弘伟' AND NOT zyjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ <= '2016-05-19')
css
CREATE TABLE table_204_799 ( id number, "name" text, "built" text, "listed" text, "location" text, "county" text, "type" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- homochitto river bridge is in the same county as what other bridge built ...
SELECT "name" FROM table_204_799 WHERE "built" = 1920 AND "county" = (SELECT "county" FROM table_204_799 WHERE "name" = 'homochitto river bridge')
squall
CREATE TABLE table_name_50 ( stopping_pattern VARCHAR, platform VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Stopping pattern has a Platform of [2777] mciver station platforms?
SELECT stopping_pattern FROM table_name_50 WHERE platform = "[2777] mciver station platforms"
sql_create_context
CREATE TABLE table_33211 ( "Name" text, "Team" text, "Qual 1" text, "Qual 2" text, "Best" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who in Qual 2 had the best time of 1:31.327?
SELECT "Qual 2" FROM table_33211 WHERE "Best" = '1:31.327'
wikisql
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 text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT lab.fluid FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.name = "Stephanie Suchan"
mimicsql_data
CREATE TABLE table_15354 ( "Date" text, "City" text, "Event" text, "Winner" text, "Prize" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the winner of the European Poker Tour Grand Final?
SELECT "Winner" FROM table_15354 WHERE "Event" = 'european poker tour grand final'
wikisql
CREATE TABLE table_name_98 ( city_of_license VARCHAR, call_sign VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which city of license has the Kyli call sign?
SELECT city_of_license FROM table_name_98 WHERE call_sign = "kyli"
sql_create_context
CREATE TABLE table_21501564_1 ( week__number VARCHAR, original_artist VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What week #(s featured sara bareilles as the original artist?
SELECT week__number FROM table_21501564_1 WHERE original_artist = "Sara Bareilles"
sql_create_context
CREATE TABLE table_name_22 ( country VARCHAR, total VARCHAR, finish VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which country has a total less than 289 and finished t2?
SELECT country FROM table_name_22 WHERE total < 289 AND finish = "t2"
sql_create_context
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 int, capacity int, pay_load int, cruising_speed int, range_...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILAD...
atis
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "49" AND prescriptions.formulary_drug_cd = "MORP0.5-4"
mimicsql_data
CREATE TABLE table_32891 ( "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. -- What is the home side's score at western oval?
SELECT "Home team score" FROM table_32891 WHERE "Venue" = 'western oval'
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Self Pay" AND diagnoses.icd9_code = "32723"
mimicsql_data
CREATE TABLE table_name_52 ( runner_s__up VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the Runner(s)-up of the 1956 Championship?
SELECT runner_s__up FROM table_name_52 WHERE year = "1956"
sql_create_context
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 lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "50805"
mimicsql_data
CREATE TABLE table_203_501 ( id number, "title" text, "genre" text, "sub\u00addivisions" text, "libretto" text, "premiere date" text, "place, theatre" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many of his operettas were 3 acts ?
SELECT COUNT("title") FROM table_203_501 WHERE "sub\u00addivisions" = '3 acts'
squall
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime ti...
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, 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_i...
mimic_iii
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 All_Home, School_ID FROM basketball_match GROUP BY ACC_Home, All_Home ORDER BY School_ID DESC
nvbench
CREATE TABLE table_70415 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Performance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the latest year in which she took 4th position in Budapest, Hungary?
SELECT MAX("Year") FROM table_70415 WHERE "Position" = '4th' AND "Venue" = 'budapest, hungary'
wikisql
CREATE TABLE staff ( staff_id TINYINT UNSIGNED, first_name VARCHAR(45), last_name VARCHAR(45), address_id SMALLINT UNSIGNED, picture BLOB, email VARCHAR(50), store_id TINYINT UNSIGNED, active BOOLEAN, username VARCHAR(16), password VARCHAR(40), last_update TIMESTAMP ) CREATE...
SELECT payment_date, COUNT(payment_date) FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa' ORDER BY COUNT(payment_date)
nvbench
CREATE TABLE table_name_44 ( rank INTEGER, nation VARCHAR, total VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What rank is Belarus (BLR), which earned 15 medals total?
SELECT MAX(rank) FROM table_name_44 WHERE nation = "belarus (blr)" AND total < 15
sql_create_context
CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE semester ( semester_id int, semester varchar, year int )...
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'department0' AND course.number BETWEEN 500 AND 500 + 100 AND semester.semester IN ('SP', 'SU', 'SS') AND semester.semester_i...
advising
CREATE TABLE bdmzjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH number, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZD...
SELECT jyjgzbb.JYZBLSH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = ...
css
CREATE TABLE table_77236 ( "Opposing Team" text, "Against" real, "Date" text, "Venue" text, "Status" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which venue has an against value larger than 21 and had Argentina as an opposing team.
SELECT "Venue" FROM table_77236 WHERE "Against" > '21' AND "Opposing Team" = 'argentina'
wikisql
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_20...
SELECT Country, COUNT(*) FROM stadium GROUP BY Country ORDER BY Country
nvbench
CREATE TABLE table_name_25 ( republican VARCHAR, lead_margin INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What percentage did Republish Christopher Reed receive when the lead margin was smaller than 16?
SELECT republican AS :_christopher_reed FROM table_name_25 WHERE lead_margin < 16
sql_create_context
CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE restriction ( restriction_c...
SELECT DISTINCT flight.flight_id FROM airport, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight, flight_stop WHERE (airport.airport_code = 'DTW' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN DIEGO' AND flight_stop.stop_ai...
atis
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t4.diagnosistime) > 3 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.uniquepid, t2.diagnosistime FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid...
eicu
CREATE TABLE table_1717824_3 ( indians_admitted VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many Indians were admitted in 2001?
SELECT indians_admitted FROM table_1717824_3 WHERE year = 2001
sql_create_context
CREATE TABLE party ( Party_ID int, Minister text, Took_office text, Left_office text, Region_ID int, Party_name text ) CREATE TABLE party_events ( Event_ID int, Event_Name text, Party_ID int, Member_in_charge_ID int ) CREATE TABLE member ( Member_ID int, Member_Name tex...
SELECT Party_name, COUNT(*) FROM party_events AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_ID ORDER BY COUNT(*)
nvbench
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Prsnl hst colonic polyps" AND lab.fluid = "Blood"
mimicsql_data
CREATE TABLE table_25723 ( "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 t...
SELECT "Team" FROM table_25723 WHERE "Date" = 'November 24'
wikisql
CREATE TABLE organisations ( organisation_id number, organisation_type text, organisation_details text ) CREATE TABLE project_staff ( staff_id number, project_id number, role_code text, date_from time, date_to time, other_details text ) CREATE TABLE projects ( project_id number...
SELECT T1.project_details FROM projects AS T1 JOIN project_outcomes AS T2 ON T1.project_id = T2.project_id WHERE T2.outcome_code = 'Paper' INTERSECT SELECT T1.project_details FROM projects AS T1 JOIN project_outcomes AS T2 ON T1.project_id = T2.project_id WHERE T2.outcome_code = 'Patent'
spider
CREATE TABLE table_33401 ( "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. -- What was the venue where the home team scored 11...
SELECT "Venue" FROM table_33401 WHERE "Home team score" = '11.12 (78)'
wikisql
CREATE TABLE table_36859 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Attendance" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the visitor on March 27?
SELECT "Visitor" FROM table_36859 WHERE "Date" = 'march 27'
wikisql
CREATE TABLE table_43303 ( "Television service" text, "Country" text, "Language" text, "Content" text, "HDTV" text, "Package/Option" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What language is telemarket for you?
SELECT "Language" FROM table_43303 WHERE "Television service" = 'telemarket for you'
wikisql
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversa...
SELECT UserId AS "user_link", COUNT(*) AS "gold_badges", (SELECT usr.Reputation FROM Users AS usr WHERE usr.Id = UserId) AS Reputation, (COUNT(*) / CAST((SELECT usr.Reputation FROM Users AS usr WHERE usr.Id = UserId AND usr.Reputation > 1000) AS FLOAT(9, 2))) AS "gold_badge_efficiency" FROM Badges WHERE Name IN ('Copy ...
sede
CREATE TABLE table_1220125_4 ( fate VARCHAR, commissioned VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the fate for 11 april 1944?
SELECT fate FROM table_1220125_4 WHERE commissioned = "11 April 1944"
sql_create_context
CREATE TABLE table_23639 ( "County" text, "Obama %" text, "Obama #" real, "McCain %" text, "McCain #" real, "Others %" text, "Others #" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What percentage of voters voted for a third party in the c...
SELECT "Others %" FROM table_23639 WHERE "Others #" = '802'
wikisql
CREATE TABLE table_204_548 ( id number, "team" text, "basic elements" number, "tumbling" number, "stunts" number, "tosses" number, "pyramids" number, "deductions" number, "total score" number, "result" text ) -- Using valid SQLite, answer the following questions for the tables ...
SELECT "team" FROM table_204_548 WHERE "team" IN ('adamson pep squad', 'pup stars') ORDER BY "tosses" DESC LIMIT 1
squall
CREATE TABLE club ( clubid number, clubname text, clubdesc text, clublocation text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE member_of_club ( stuid number, clu...
SELECT clubdesc FROM club WHERE clubname = "Pen and Paper Gaming"
spider
CREATE TABLE table_19749 ( "Institution" text, "Location" text, "Team Nickname" text, "Tenure" text, "New Conference" text, "New Classification" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the new classification for the University of ...
SELECT "New Classification" FROM table_19749 WHERE "Institution" = 'University of Arizona'
wikisql
CREATE TABLE table_37454 ( "Team" text, "Driver" text, "Laps" real, "Time" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest laps driver Christian Vietoris with a grid smaller than 6 has?
SELECT MIN("Laps") FROM table_37454 WHERE "Driver" = 'christian vietoris' AND "Grid" < '6'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) CREATE TABLE zyjzjlb ( YLJGDM text, JZLSH text, MZJZLSH text, KH text, KLX number, HZXM text, WDBZ number, RYDJSJ time, RYTJDM number, RYTJMC text, JZKSDM text, JZKSMC text, RZBQDM t...
SELECT JCXMMC, JCZBDM, JCZBMC, JCFF FROM jyjgzbb WHERE JYZBLSH = '96453878046'
css
CREATE TABLE table_33681 ( "Network" text, "Origin of Programming" text, "Language" text, "Genre" text, "Service" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What network has an origin in India, a genre of general, and broadcasts in Bengali?
SELECT "Network" FROM table_33681 WHERE "Origin of Programming" = 'india' AND "Genre" = 'general' AND "Language" = 'bengali'
wikisql
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS va...
SELECT COMMISSION_PCT, DEPARTMENT_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
nvbench
CREATE TABLE table_204_457 ( id number, "ship name" text, "desig" text, "status" text, "notes" text, "links" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the name of the ship listed before the maryland ?
SELECT "ship name" FROM table_204_457 WHERE id = (SELECT id FROM table_204_457 WHERE "ship name" = 'maryland') - 1
squall
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.short_title = "Dvrtcli colon w/o hmrhg" AND lab.flag = "abnormal"
mimicsql_data
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wa...
SELECT microlab.culturesite FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-22988' AND NOT patient.hospitaldischargetime IS NULL ORDER BY pati...
eicu
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE TagSynonyms ( Id number...
SELECT CAST(TIME_TO_STR(Answer.CreationDate, '%Y-%m-%d') AS TEXT(7)) AS Month, COUNT(Answer.Id) AS Answers FROM Posts AS Answer JOIN Posts AS Question ON Question.Id = Answer.ParentId WHERE Question.PostTypeId = 1 AND Answer.PostTypeId = 2 AND (Question.Tags LIKE '%<amazon-%' OR Question.Tags LIKE '%<aws-%') AND Answer...
sede
CREATE TABLE table_name_81 ( format VARCHAR, label VARCHAR, catalog VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Format for the alfa records Label, and a Catalog of alca-9016?
SELECT format FROM table_name_81 WHERE label = "alfa records" AND catalog = "alca-9016"
sql_create_context
CREATE TABLE table_17163 ( "Series" text, "Monday" text, "Tuesday" text, "Wednesday" text, "Thursday" text, "Friday" text, "Saturday" text, "Sunday" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the thursday presenter of the show...
SELECT "Thursday" FROM table_17163 WHERE "Series" = 'Big Brother 13'
wikisql
CREATE TABLE table_27614707_1 ( week__number VARCHAR, theme VARCHAR, order__number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many different weeks are there in order number 4 that were judge's choice?
SELECT COUNT(week__number) FROM table_27614707_1 WHERE theme = "Judge's Choice" AND order__number = "4"
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE l...
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '016-27397' AND STRFTIME('%y', patient.hospitaladmittime) = '2105' ORDER BY patient.hospitaladmittime LIMIT 1
eicu
CREATE TABLE election ( Election_ID int, Counties_Represented text, District int, Delegate text, Party int, First_Elected real, Committee text ) CREATE TABLE party ( Party_ID int, Year real, Party text, Governor text, Lieutenant_Governor text, Comptroller text, A...
SELECT Committee, COUNT(Committee) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic" GROUP BY Committee
nvbench
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
SELECT jyjgzbb.JCFF 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...
css
CREATE TABLE gyb ( CLINIC_ID 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, INSU_TYPE text, IN...
SELECT qtb.MED_CLINIC_ID FROM qtb WHERE qtb.PERSON_ID = '94878508' AND qtb.MED_SER_ORG_NO = '4527027' AND qtb.IN_DIAG_DIS_NM LIKE '%2%' UNION SELECT gyb.MED_CLINIC_ID FROM gyb WHERE gyb.PERSON_ID = '94878508' AND gyb.MED_SER_ORG_NO = '4527027' AND gyb.IN_DIAG_DIS_NM LIKE '%2%' UNION SELECT zyb.MED_CLINIC_ID FROM zyb WH...
css
CREATE TABLE table_22669044_8 ( team VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the team for w 115 104 (ot)
SELECT team FROM table_22669044_8 WHERE score = "W 115–104 (OT)"
sql_create_context
CREATE TABLE table_28622 ( "Year" real, "Under-11" text, "Under-13" text, "Under-15" text, "Under-17" text, "Under-19" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is everyone Under-11 if Under-17 is Salma Nassar?
SELECT "Under-11" FROM table_28622 WHERE "Under-17" = 'Salma Nassar'
wikisql
CREATE TABLE table_35170 ( "Round" real, "Pick" real, "Player" text, "Position" text, "School/Club Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which school of club team has a pick of 46?
SELECT "School/Club Team" FROM table_35170 WHERE "Pick" = '46'
wikisql
CREATE TABLE cinema ( Id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many cinema do we have?
SELECT COUNT(*) FROM cinema
sql_create_context
CREATE TABLE table_name_23 ( fleet_series__quantity_ VARCHAR, builder VARCHAR, order_year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Fleet Series (Quantity) that has a Builder of mci, and an Order Year of 2002?
SELECT fleet_series__quantity_ FROM table_name_23 WHERE builder = "mci" AND order_year = "2002"
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.icd9_code = "252"
mimicsql_data
CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pre...
SELECT date, AVG(cloud_cover) FROM weather ORDER BY AVG(cloud_cover)
nvbench
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 prescriptions ( subject_id text, hadm_id...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "METR500PM" AND lab.fluid = "Ascites"
mimicsql_data
CREATE TABLE table_204_481 ( id number, "poll source" text, "date(s)\nadministered" text, "sample\nsize" number, "margin of\nerror" text, "andrew\ncuomo (d)" text, "rob\nastorino (r)" text, "other" text, "undecided" text ) -- Using valid SQLite, answer the following questions for t...
SELECT COUNT("poll source") FROM table_204_481 WHERE "rob\nastorino (r)" < 25
squall
CREATE TABLE table_2148 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result of the Georgia 8 district?
SELECT "Result" FROM table_2148 WHERE "District" = 'Georgia 8'
wikisql
CREATE TABLE table_name_83 ( riding_penalties__pts_ VARCHAR, swimming_time__pts_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the riding penaltie (pts) for the athlete that has a Swimming Time (pts) of 2:18.16 (1264)?
SELECT riding_penalties__pts_ FROM table_name_83 WHERE swimming_time__pts_ = "2:18.16 (1264)"
sql_create_context
CREATE TABLE table_name_12 ( median_family_income VARCHAR, median_household_income VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Median family income has a Median household income of $43,125?
SELECT median_family_income FROM table_name_12 WHERE median_household_income = "$43,125"
sql_create_context
CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE course_prerequisite ( pre_cour...
SELECT DISTINCT semester.semester, semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 480 AND semester.semester_id = course_offering.semester AND semester.year IN (2016, 2017)
advising
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code te...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissi...
mimic_iii
CREATE TABLE technician ( technician_id real, Name text, Team text, Starting_Year real, Age int ) CREATE TABLE repair_assignment ( technician_id int, repair_ID int, Machine_ID int ) CREATE TABLE machine ( Machine_ID int, Making_Year int, Class text, Team text, Machi...
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 T2.quality_rank
nvbench
CREATE TABLE table_54889 ( "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. -- What is the highest crowd for Home team of geelo...
SELECT MAX("Crowd") FROM table_54889 WHERE "Home team" = 'geelong'
wikisql