instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
SELECT demographic.admission_type, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "3343"
mimicsql_data
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, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, fare, fare_basis, flight, flight_fare WHERE (((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DA...
atis
CREATE TABLE table_name_30 ( home_team VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What did the home team score at MCG?
SELECT home_team AS score FROM table_name_30 WHERE venue = "mcg"
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND procedures.long_title = "Other endoscopy of small intestine"
mimicsql_data
CREATE TABLE table_name_36 ( total INTEGER, rank VARCHAR, silver VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average Total for the Rank of 6, when Silver is smaller than 0?
SELECT AVG(total) FROM table_name_36 WHERE rank = 6 AND silver < 0
sql_create_context
CREATE TABLE table_39701 ( "Call sign" text, "Launched" text, "Transmitting from" text, "Coverage" text, "Languages" text, "Frequency" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the coverage of the station that was launched on 22 Jan...
SELECT "Coverage" FROM table_39701 WHERE "Launched" = '22 january 1996'
wikisql
CREATE TABLE table_19246_1 ( standard VARCHAR, launch_date__ddmmyyyy_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many standards are there, when the launch date was 17.04.2006?
SELECT COUNT(standard) FROM table_19246_1 WHERE launch_date__ddmmyyyy_ = "17.04.2006"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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, ...
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE wdmzjzjlb.JZZDSM = '躁狂型精神病' AND jyjgzbb.JCZBDM = '758740' UNION SELECT jyjgzbb.CKZFWXX...
css
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid n...
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 7241) AND prescriptions.drug = 'entacapone' AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-95 month')
mimic_iii
CREATE TABLE table_54900 ( "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 score did the opposing home team have again...
SELECT "Home team score" FROM table_54900 WHERE "Away team" = 'melbourne'
wikisql
CREATE TABLE table_name_49 ( gold VARCHAR, bronze VARCHAR, total VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of gold medals of the nation with 1 bronze and less than 1 total medal?
SELECT COUNT(gold) FROM table_name_49 WHERE bronze = 1 AND total < 1
sql_create_context
CREATE TABLE table_1342338_5 ( candidates VARCHAR, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who ran in the election where Claude Fuller was the incumbent?
SELECT candidates FROM table_1342338_5 WHERE incumbent = "Claude Fuller"
sql_create_context
CREATE TABLE table_1342149_13 ( candidates VARCHAR, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the candidates for fred e. busbey?
SELECT candidates FROM table_1342149_13 WHERE incumbent = "Fred E. Busbey"
sql_create_context
CREATE TABLE table_29202276_2 ( origin VARCHAR, destination VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the origin when the destination is Mumbai?
SELECT origin FROM table_29202276_2 WHERE destination = "Mumbai"
sql_create_context
CREATE TABLE table_name_38 ( winners INTEGER, runners_up INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When the Runners-Up is larger than 0, what's the sum of winners?
SELECT SUM(winners) FROM table_name_38 WHERE runners_up > 0
sql_create_context
CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE student ( student_id int, lastname varchar, ...
SELECT DISTINCT course.name, course.number, program_course.workload FROM course, program_course WHERE course.department = 'EECS' AND course.number BETWEEN 300 AND 300 + 100 AND program_course.course_id = course.course_id AND program_course.workload < 3 ORDER BY program_course.workload
advising
CREATE TABLE table_18726 ( "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 district did James O'Connor belong to?
SELECT "District" FROM table_18726 WHERE "Incumbent" = 'James O''Connor'
wikisql
CREATE TABLE table_name_97 ( title VARCHAR, director VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the movie that Paul Schneider directed?
SELECT title FROM table_name_97 WHERE director = "paul schneider"
sql_create_context
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 AVG(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 7400)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'tempe...
mimic_iii
CREATE TABLE table_7886 ( "Season" text, "Skip" text, "Third" text, "Second" text, "Lead" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Season, when Third is 'Glen Muirhead'?
SELECT "Season" FROM table_7886 WHERE "Third" = 'glen muirhead'
wikisql
CREATE TABLE table_41097 ( "Ship" text, "13.5-inch/1400lb" real, "13.5-inch/1250lb" real, "12-inch" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest Total when the ship was l tzow, and a 12-inch less than 8?
SELECT MAX("Total") FROM table_41097 WHERE "Ship" = 'lützow' AND "12-inch" < '8'
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "1846" AND prescriptions.route = "PO"
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 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Unspecified disease of pericardium"
mimicsql_data
CREATE TABLE table_13029 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponents in the final" text, "Score in the final" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Opponents in the final has a ...
SELECT "Opponents in the final" FROM table_13029 WHERE "Partner" = 'olga lugina'
wikisql
CREATE TABLE table_name_49 ( aggregate VARCHAR, club VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which aggregate has ajax as the club?
SELECT aggregate FROM table_name_49 WHERE club = "ajax"
sql_create_context
CREATE TABLE table_name_59 ( qualities VARCHAR, sign VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the qualities of the sign cancer?
SELECT qualities FROM table_name_59 WHERE sign = "cancer"
sql_create_context
CREATE TABLE room ( roomtype VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many different types of rooms are there?
SELECT COUNT(DISTINCT roomtype) FROM room
sql_create_context
CREATE TABLE table_13731 ( "Date" text, "Ship" text, "Nationality" text, "Tonnage" real, "Fate" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the date for the ship Afrika, with nationality Great Britain?
SELECT "Date" FROM table_13731 WHERE "Nationality" = 'great britain' AND "Ship" = 'afrika'
wikisql
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( ...
SELECT t3.drugname FROM (SELECT t2.drugname, 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 = 'anemia - anemia of chronic disease' AND STRFTIME('...
eicu
CREATE TABLE table_name_94 ( size VARCHAR, date INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the size which is past 2000
SELECT size FROM table_name_94 WHERE date > 2000
sql_create_context
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE class_of_servi...
SELECT DISTINCT flight.flight_id FROM airport, airport_service, city, flight, food_service WHERE ((airport.airport_code = 'BWI' AND flight.to_airport = airport.airport_code AND food_service.meal_code = flight.meal_code AND food_service.meal_description = 'DINNER') AND city.city_code = airport_service.city_code AND city...
atis
CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE dual_carrier ( ...
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 = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKL...
atis
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE PostHistoryTypes ( Id number, Name te...
SELECT TagName, COUNT(TagName) FROM Posts INNER JOIN PostTags ON PostTags.PostId = Posts.Id INNER JOIN Tags ON PostTags.TagId = Tags.Id WHERE Tags.TagName IN ('clojure', 'elm', 'python', 'racket') AND Posts.PostTypeId = 1 GROUP BY TagName
sede
CREATE TABLE table_2135222_2 ( traditional VARCHAR, density VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the traditional with density of 820?
SELECT traditional FROM table_2135222_2 WHERE density = 820
sql_create_context
CREATE TABLE Documents_with_Expenses ( Document_ID INTEGER, Budget_Type_Code CHAR(15), Document_Details VARCHAR(255) ) CREATE TABLE Ref_Budget_Codes ( Budget_Type_Code CHAR(15), Budget_Type_Description VARCHAR(255) ) CREATE TABLE Accounts ( Account_ID INTEGER, Statement_ID INTEGER, Acc...
SELECT Document_Date, COUNT(Document_Date) FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code GROUP BY Document_Type_Description ORDER BY Document_Date DESC
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions...
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.long_title = "Cardiac complications, not elsewhere classified" AND prescriptions.route = "DWELL"
mimicsql_data
CREATE TABLE table_50903 ( "Team" text, "Coach" text, "Home Ground" text, "Location" text, "Founded" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the coach of the team with home ground at Club Cove?
SELECT "Coach" FROM table_50903 WHERE "Home Ground" = 'club cove'
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 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 = "Bone marrow replaced by transplant" AND lab.fluid = "Pleural"
mimicsql_data
CREATE TABLE table_11273 ( "Draw" real, "Artist" text, "Song" text, "Points" real, "Place" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the sum of points for artist hari mata hari?
SELECT SUM("Points") FROM table_11273 WHERE "Artist" = 'hari mata hari'
wikisql
CREATE TABLE table_549 ( "Championship" text, "Champion(s)" text, "Previous champion(s)" text, "Date Won" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the champion prior to Xix Xavant?
SELECT "Previous champion(s)" FROM table_549 WHERE "Champion(s)" = 'Xix Xavant'
wikisql
CREATE TABLE table_203_320 ( id number, "rank in\n2011" number, "name of\nconcern" text, "location of\nheadquarters" text, "revenue\n(thou.\npln)" number, "profit\n(thou.\npln)" number, "employees" number ) -- Using valid SQLite, answer the following questions for the tables provided above...
SELECT "name of\nconcern" FROM table_203_320 ORDER BY "revenue\n(thou.\npln)" DESC LIMIT 1
squall
CREATE TABLE table_24639086_3 ( series__number INTEGER, season__number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the series minimum if the season number is 2.08?
SELECT MIN(series__number) FROM table_24639086_3 WHERE season__number = "2.08"
sql_create_context
CREATE TABLE table_10041 ( "Name" text, "Country" text, "Transfer window" text, "Transfer fee" text, "Apps" real, "Goals" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many times is the transfer window, summer and the name sinclair?
SELECT COUNT("Apps") FROM table_10041 WHERE "Transfer window" = 'summer' AND "Name" = 'sinclair'
wikisql
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImage...
SELECT COUNT(*), MAX(a.CreationDate) AS LastOccurance, q.OwnerUserId AS "user_link", qu.Reputation AS AskerReputation, a.OwnerUserId AS "user_link", au.Reputation AS AnswererReputation, apc.TotalAnswers FROM Posts AS q INNER JOIN Posts AS a ON q.AcceptedAnswerId = a.Id INNER JOIN Users AS qu ON qu.Id = q.OwnerUserId IN...
sede
CREATE TABLE table_16993379_1 ( rating VARCHAR, rank__overall_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the rating of the episode with an overall ranking of 190?
SELECT rating FROM table_16993379_1 WHERE rank__overall_ = "190"
sql_create_context
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT gwyjzb.OUT_DIAG_DOC_CD, gwyjzb.OUT_DIAG_DOC_NM FROM gwyjzb WHERE gwyjzb.PERSON_ID = '68080036' AND gwyjzb.IN_HOSP_DATE BETWEEN '2007-06-03' AND '2016-05-26' GROUP BY gwyjzb.OUT_DIAG_DOC_CD ORDER BY COUNT(*) DESC LIMIT 1 UNION SELECT fgwyjzb.OUT_DIAG_DOC_CD, fgwyjzb.OUT_DIAG_DOC_NM FROM fgwyjzb WHERE fgwyjzb.PERS...
css
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit ...
SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 96774) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'potassium, whole blood') AND STRFTIME('%y-%m', labevents.charttime) <= '2105-05...
mimic_iii
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 COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-17834')) AND microlab.culturesite = 'sputum, tracheal specimen' AND STRFTI...
eicu
CREATE TABLE table_26967904_1 ( p_max___bar__ INTEGER, chambering VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the p max (bar) in the pistol where the chambering is .45 ACP?
SELECT MAX(p_max___bar__) FROM table_26967904_1 WHERE chambering = ".45 ACP"
sql_create_context
CREATE TABLE table_75447 ( "Celebrity" text, "Famous for" text, "Entered" text, "Exited" text, "Finished" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What position did the celebrity finish that entered on day 1 and exited on day 15?
SELECT "Finished" FROM table_75447 WHERE "Entered" = 'day 1' AND "Exited" = 'day 15'
wikisql
CREATE TABLE table_3499 ( "Institution" text, "Location" text, "Founded" real, "Type" text, "Enrollment" text, "Nickname" text, "Joined" text, "Left" text, "Football Conference" text, "Primary Conference" text ) -- Using valid SQLite, answer the following questions for the tabl...
SELECT "Joined" FROM table_3499 WHERE "Left" = '2013' AND "Nickname" = 'Corsairs'
wikisql
CREATE TABLE table_73427 ( "Pos" real, "Club" text, "Games played" real, "Red/Yellow cards" real, "Positive play" real, "Respect toward opponents" real, "Respect toward referee" real, "Behaviour of team officials" real, "Points" real, "Score" text, "Average" text ) -- Using...
SELECT MAX("Red/Yellow cards") FROM table_73427 WHERE "Positive play" = '255'
wikisql
CREATE TABLE table_204_804 ( id number, "version" text, "length" text, "album" text, "remixed by" text, "year" number, "comment" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many versions are at least 7 minutes long ?
SELECT COUNT("version") FROM table_204_804 WHERE "length" >= 7
squall
CREATE TABLE table_71339 ( "Date" text, "Venue" text, "Opponent" text, "Result" text, "Tournament" text, "Scored" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where did they play that the score was 22-12?
SELECT "Venue" FROM table_71339 WHERE "Result" = '22-12'
wikisql
CREATE TABLE table_55141 ( "Title" text, "Publisher" text, "First Year" text, "Last Year" text, "Genre" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who published Weird War Tales?
SELECT "Publisher" FROM table_55141 WHERE "Title" = 'weird war tales'
wikisql
CREATE TABLE table_name_53 ( runner_up VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the runner-up at the event held in Tartu, Estonia?
SELECT runner_up FROM table_name_53 WHERE venue = "tartu, estonia"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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...
SELECT jyjgzbb.JCFF 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.YLJG...
css
CREATE TABLE table_52466 ( "Player" text, "Height" text, "School" text, "Hometown" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which college is the player from South Medford High School headed to?
SELECT "College" FROM table_52466 WHERE "School" = 'south medford high school'
wikisql
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 ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t1.itemid FROM (SELECT labevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM labevents WHERE DATETIME(labevents.charttime) >= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY labevents.itemid) AS t1 WHERE t1.c1 <= 3)
mimic_iii
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 AVG(demographic.age) FROM demographic WHERE demographic.discharge_location = "HOME" AND demographic.diagnosis = "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT "
mimicsql_data
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id ...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT procedures_icd.icd9_code FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 81562) AND DATETIME(procedures_icd.charttime) <= DATETIME(CURRENT_TI...
mimic_iii
CREATE TABLE table_15849 ( "Order Year" text, "Manufacturer" text, "Model" text, "Fleet Series (Quantity)" text, "Powertrain (Engine/Transmission)" text, "Fuel Propulsion" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many times is the flee...
SELECT COUNT("Order Year") FROM table_15849 WHERE "Fleet Series (Quantity)" = '468-473 (6)'
wikisql
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_DIRE_CD text, MED_DIRE_NM text,...
SELECT * FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '8417883' AND t_kc21.IN_HOSP_DATE BETWEEN '2014-10-07' AND '2015-04-15' AND t_kc21.PERSON_NM LIKE '郑%'
css
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE allergy ( allergy...
SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-4471')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput...
eicu
CREATE TABLE table_62988 ( "Year" real, "Winner" text, "Jockey" text, "Trainer" text, "Owner" text, "Distance" text, "Time" text, "Purse" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the distance in 2006?
SELECT "Distance" FROM table_62988 WHERE "Year" = '2006'
wikisql
CREATE TABLE Addresses ( address_id INTEGER, address_details VARCHAR(255) ) CREATE TABLE Customer_Addresses ( customer_id INTEGER, address_id INTEGER, date_from DATETIME, date_to DATETIME ) CREATE TABLE Customer_Orders ( order_id INTEGER, customer_id INTEGER, order_status_code VARC...
SELECT product_type_code, MIN(product_price) FROM Products GROUP BY product_type_code ORDER BY product_type_code
nvbench
CREATE TABLE table_name_94 ( games INTEGER, order VARCHAR, goals VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many games have an Order of 1006, and Goals larger than 192?
SELECT SUM(games) FROM table_name_94 WHERE order = 1006 AND goals > 192
sql_create_context
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) -- Using valid SQLite, answer the following questions for the...
SELECT T2.Name, AVG(T1.Price) 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_5375 ( "Game" real, "January" real, "Opponent" text, "Score" text, "Record" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Points have a Record of 21 20 6?
SELECT SUM("Points") FROM table_5375 WHERE "Record" = '21–20–6'
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 MAX(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.insurance = "Self Pay"
mimicsql_data
CREATE TABLE table_14600 ( "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. -- Who was the opponent of the runner-up after 2012?
SELECT "Opponents" FROM table_14600 WHERE "Year" > '2012' AND "Outcome" = 'runner-up'
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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "45" AND prescriptions.formulary_drug_cd = "LEVO75"
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 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Other shock without mention of trauma"
mimicsql_data
CREATE TABLE images ( image_id number, image_alt_text text, image_name text, image_url text ) CREATE TABLE users ( user_id number, role_code text, user_name text, user_login text, password text ) CREATE TABLE document_sections_images ( section_id number, image_id number ) ...
SELECT document_name, access_count FROM documents ORDER BY document_name
spider
CREATE TABLE table_15039 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which of the chassis had a total of 7 points?
SELECT "Chassis" FROM table_15039 WHERE "Points" = '7'
wikisql
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE medication ( me...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-50213'...
eicu
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 hz_info ( KH text, KLX number...
SELECT jyjgzbb.YQBH, jyjgzbb.YQMC FROM hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH ...
css
CREATE TABLE table_72298 ( "Episode" text, "Song choice" text, "Original artist" text, "Order #" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which one of the songs was originally performed by Rickie Lee Jones?
SELECT "Song choice" FROM table_72298 WHERE "Original artist" = 'Rickie Lee Jones'
wikisql
CREATE TABLE zyjybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH number, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, ...
SELECT zyjybgb.BBCJBW FROM zyjybgb WHERE zyjybgb.BGDH = '33508848033' UNION SELECT mzjybgb.BBCJBW FROM mzjybgb WHERE mzjybgb.BGDH = '33508848033'
css
CREATE TABLE table_67150 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the loss in the game with the record of 65-53?
SELECT "Loss" FROM table_67150 WHERE "Record" = '65-53'
wikisql
CREATE TABLE table_name_32 ( silver INTEGER, total INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest number of silver medals for a team with total less than 1?
SELECT MAX(silver) FROM table_name_32 WHERE total < 1
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND lab.itemid = "51222"
mimicsql_data
CREATE TABLE table_203_47 ( id number, "game" number, "date" text, "opponent" text, "location" text, "score" text, "ot" text, "attendance" number, "record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many home games were playe...
SELECT COUNT("game") FROM table_203_47 WHERE "opponent" = 'home'
squall
CREATE TABLE hz_info_mzjzjlb ( JZLSH number, YLJGDM number, mzjzjlb_id number ) 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, ...
SELECT jyjgzbb.JYZBLSH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jy...
css
CREATE TABLE table_name_29 ( losing_bonus VARCHAR, try_bonus VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Losing Bonus has a Try Bonus of 8?
SELECT losing_bonus FROM table_name_29 WHERE try_bonus = "8"
sql_create_context
CREATE TABLE Ref_Budget_Codes ( Budget_Type_Code CHAR(15), Budget_Type_Description VARCHAR(255) ) CREATE TABLE Documents ( Document_ID INTEGER, Document_Type_Code CHAR(15), Project_ID INTEGER, Document_Date DATETIME, Document_Name VARCHAR(255), Document_Description VARCHAR(255), Oth...
SELECT Document_Type_Description, COUNT(Document_Type_Description) FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code GROUP BY Document_Type_Description
nvbench
CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE author ( authorid int, authorname varchar ...
SELECT DISTINCT paper.paperid FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'monte carlo simulation' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND paper.year > 2011
scholar
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 (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 739) AND icustays.outtime IS NULL) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_ite...
mimic_iii
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TAB...
SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 50 AND 59) GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 3
eicu
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE patients ( row_id number,...
SELECT AVG(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 31473)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'hear...
mimic_iii
CREATE TABLE enroll ( class_code text, stu_num number, enroll_grade text ) CREATE TABLE professor ( emp_num number, dept_code text, prof_office text, prof_extension text, prof_high_degree text ) CREATE TABLE employee ( emp_num number, emp_lname text, emp_fname text, emp...
SELECT AVG(T2.stu_gpa) FROM enroll AS T1 JOIN student AS T2 ON T1.stu_num = T2.stu_num JOIN class AS T3 ON T1.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211'
spider
CREATE TABLE table_275023_1 ( formed_from VARCHAR, province VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What province was New Plymouth formed from?
SELECT formed_from FROM table_275023_1 WHERE province = "New Plymouth"
sql_create_context
CREATE TABLE table_68668 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the highest year with points more than 0
SELECT MAX("Year") FROM table_68668 WHERE "Points" > '0'
wikisql
CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER ) CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Give me a pie to show the a...
SELECT gender, AVG(age) FROM Person GROUP BY gender
nvbench
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE lab ( labid number, pa...
SELECT DISTINCT t1.c1 FROM (SELECT lab.labresult, PERCENT_RANK() OVER (ORDER BY lab.labresult) AS c1 FROM lab WHERE lab.labname = 'calcium' AND lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age = (SELECT patient.age FROM patient WHERE patient.uniquepid = '032-21820' AND patient.h...
eicu
CREATE TABLE table_name_29 ( bronze VARCHAR, rank VARCHAR, total VARCHAR, gold VARCHAR, silver VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many bronze medals for the nation with fewer than 3 gold, 1 silver and rank of 3?
SELECT COUNT(bronze) FROM table_name_29 WHERE gold < 3 AND silver = 1 AND total < 3 AND rank = 3
sql_create_context
CREATE TABLE table_72082 ( "Country ( exonym )" text, "Capital ( exonym )" text, "Country ( endonym )" text, "Capital ( endonym )" text, "Official or native language(s) (alphabet/script)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lo...
SELECT "Capital ( endonym )" FROM table_72082 WHERE "Capital ( exonym )" = 'Canberra'
wikisql
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
SELECT AVG(MED_AMOUT) FROM t_kc24 WHERE MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_AGE >= 25)
css
CREATE TABLE Medication ( Code INTEGER, Name VARCHAR(30), Brand VARCHAR(30), Description VARCHAR(30) ) CREATE TABLE Patient ( SSN INTEGER, Name VARCHAR(30), Address VARCHAR(30), Phone VARCHAR(30), InsuranceID INTEGER, PCP INTEGER ) CREATE TABLE Room ( RoomNumber INTEGER, ...
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 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_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc21_t_kc22.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_NM = '曹志新' AND t_kc21.MED_SER_ORG_NO = '0686560' AND t_kc21.IN_HOSP_DATE BETWEEN '2005-12-25' AND '2012-04-14')
css