instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dob_year < "2101" AND diagnoses.short_title = "Ac posthemorrhag anemia"
mimicsql_data
CREATE TABLE table_6315 ( "Model" text, "Codename" text, "Capacities (GB)" text, "NAND type" text, "Interface" text, "Form factor" text, "Controller" text, "Seq. read/write MB/s" text, "Rnd 4KB read/write IOPS (K)" text, "Introduced" text ) -- Using valid SQLite, answer the fol...
SELECT "Interface" FROM table_6315 WHERE "Controller" = 'sandforce' AND "Codename" = 'sierra star'
wikisql
CREATE TABLE table_name_64 ( green_communist VARCHAR, left_bloc VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result for the Green-Communist party when the Left Bloc has 3.6%?
SELECT green_communist FROM table_name_64 WHERE left_bloc = "3.6%"
sql_create_context
CREATE TABLE table_name_4 ( tournament VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For the Australian Open, in 2007 the result was A, but what was the result in 2012?
SELECT 2012 FROM table_name_4 WHERE 2007 = "a" AND tournament = "australian open"
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 t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_NM, AVG(t_kc21.PERSON_AGE) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '5033672' GROUP BY t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_NM
css
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) 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, H...
SELECT SUM(t_kc24.MED_AMOUT) FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '葛曼妮' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2003-07-12' AND '2018-11-19'
css
CREATE TABLE table_name_59 ( grid INTEGER, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the highest grid for new zealand?
SELECT MAX(grid) FROM table_name_59 WHERE team = "new zealand"
sql_create_context
CREATE TABLE mzb ( 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.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 >= 9872.67) 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...
css
CREATE TABLE jybgb_jyjgzbb ( JYZBLSH number, YLJGDM text, jyjgzbb_id number ) CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, ...
SELECT jyjgzbb.JCZBMC, jyjgzbb.JCZBJGDW, AVG(jyjgzbb.JCZBJGDL) FROM jyjgzbb JOIN jybgb_jyjgzbb JOIN jybgb ON jybgb_jyjgzbb.JYZBLSH = jyjgzbb.JYZBLSH AND jybgb_jyjgzbb.jyjgzbb_id = jyjgzbb.jyjgzbb_id AND jybgb_jyjgzbb.YLJGDM = jybgb.YLJGDM WHERE jybgb.YLJGDM = '5826320' AND jyjgzbb.BGRQ BETWEEN '2010-02-23' AND '2014-09...
css
CREATE TABLE club_rank ( rank number, club_id number, gold number, silver number, bronze number, total number ) CREATE TABLE club ( club_id number, name text, region text, start_year text ) CREATE TABLE competition_result ( competition_id number, club_id_1 number, c...
SELECT COUNT(*), position FROM player WHERE points < 30 GROUP BY position
spider
CREATE TABLE table_name_69 ( builder VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the builder of the ship INS Rana?
SELECT builder FROM table_name_69 WHERE name = "ins rana"
sql_create_context
CREATE TABLE table_16388545_1 ( ground VARCHAR, crowd VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which location had an attendance of 22537?
SELECT ground FROM table_16388545_1 WHERE crowd = 22537
sql_create_context
CREATE TABLE table_name_87 ( pole_position VARCHAR, race VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the pole position for the belgian grand prix?
SELECT pole_position FROM table_name_87 WHERE race = "belgian grand prix"
sql_create_context
CREATE TABLE table_27734286_1 ( high_points VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is in the high points in the @ l.a. clippers team?
SELECT high_points FROM table_27734286_1 WHERE team = "@ L.A. Clippers"
sql_create_context
CREATE TABLE table_69231 ( "Race Title" text, "Circuit" text, "City / State" text, "Date" text, "Winner" text, "Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who won at the Oran Park Raceway?
SELECT "Winner" FROM table_69231 WHERE "Circuit" = 'oran park raceway'
wikisql
CREATE TABLE table_21436373_11 ( stadium VARCHAR, type_of_record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the stadium for regular season game
SELECT stadium FROM table_21436373_11 WHERE type_of_record = "Regular season game"
sql_create_context
CREATE TABLE table_name_13 ( position VARCHAR, round VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is round 1's position?
SELECT position FROM table_name_13 WHERE round = 1
sql_create_context
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE PostHistory ( Id num...
SELECT Users.Id AS "user_link", Reputation FROM Users INNER JOIN Posts ON Posts.OwnerUserId = Users.Id WHERE LOWER(Posts.Tags) LIKE '%windows-phone%' GROUP BY Users.Id, Reputation ORDER BY Reputation DESC
sede
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 Founder, SUM(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY SUM(Manufacturer) DESC
nvbench
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 procedures ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2174.0" AND procedures.long_title = "Incision of abdominal wall"
mimicsql_data
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 characteristics ( characteristic_id number, chara...
SELECT DISTINCT characteristic_name FROM characteristics
spider
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, ...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'ca-125'))
mimic_iii
CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE dataset ( datasetid int, datasetn...
SELECT DISTINCT COUNT(1) FROM author AS AUTHOR_0, author AS AUTHOR_1, writes AS WRITES_0, writes AS WRITES_1 WHERE AUTHOR_0.authorname = 'X Jiang' AND AUTHOR_1.authorname = 'Frantzen' AND WRITES_0.authorid = AUTHOR_0.authorid AND WRITES_1.authorid = AUTHOR_1.authorid AND WRITES_1.paperid = WRITES_0.paperid
scholar
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.admission_type = "URGENT" AND demographic.ethnicity = "HISPANIC OR LATINO"
mimicsql_data
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.short_title = "Follicular cyst of ovary"
mimicsql_data
CREATE TABLE table_name_31 ( opponent VARCHAR, game VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the opponent before game 5 with a 0-1-0 record?
SELECT opponent FROM table_name_31 WHERE game < 5 AND record = "0-1-0"
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 t_kc24.t_kc21_OUT_DIAG_DIS_CD, t_kc24.t_kc21_OUT_DIAG_DIS_NM FROM t_kc24 WHERE t_kc24.t_kc21_PERSON_NM = '范馨逸' AND t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 6053.87)
css
CREATE TABLE advisor ( s_ID varchar(5), i_ID varchar(5) ) CREATE TABLE prereq ( course_id varchar(8), prereq_id varchar(8) ) CREATE TABLE teaches ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0) ) CREATE TABLE instructor ( ID var...
SELECT name, COUNT(name) FROM course AS T1 JOIN teaches AS T2 ON T1.course_id = T2.course_id JOIN instructor AS T3 ON T2.ID = T3.ID WHERE year = 2008 GROUP BY name
nvbench
CREATE TABLE table_204_413 ( id number, "medal" text, "name" text, "sport" text, "event" text, "date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- number of silver and bronze medals for finland in the 1924 summer olympics
SELECT COUNT(*) FROM table_204_413 WHERE "medal" = 'silver' OR "medal" = 'bronze'
squall
CREATE TABLE table_58793 ( "Name" text, "Tournaments" real, "Pro Debut" text, "Top division debut" text, "Highest rank" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest Tournaments, when Pro Debut is 'July 2002'?
SELECT MAX("Tournaments") FROM table_58793 WHERE "Pro Debut" = 'july 2002'
wikisql
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 prescriptions.drug, prescriptions.route FROM prescriptions WHERE prescriptions.formulary_drug_cd = "NAPH15I"
mimicsql_data
CREATE TABLE table_name_43 ( result VARCHAR, category VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result for the nominee for Outstanding Supporting Actress in a Drama Series in 2009?
SELECT result FROM table_name_43 WHERE category = "outstanding supporting actress in a drama series" AND year = 2009
sql_create_context
CREATE TABLE table_name_5 ( tournament VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the 2011 value for the paris masters tournament with 1r in 2008?
SELECT 2011 FROM table_name_5 WHERE 2008 = "1r" AND tournament = "paris masters"
sql_create_context
CREATE TABLE table_name_52 ( player VARCHAR, position VARCHAR, school_club_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Utah Jazz guard, played at BYU?
SELECT player FROM table_name_52 WHERE position = "guard" AND school_club_team = "byu"
sql_create_context
CREATE TABLE table_name_95 ( name VARCHAR, pos VARCHAR, club VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the player from club Circolo Nautico Posillipo and a position of D?
SELECT name FROM table_name_95 WHERE pos = "d" AND club = "circolo nautico posillipo"
sql_create_context
CREATE TABLE table_name_8 ( lead VARCHAR, polling_firm VARCHAR, psoe VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is lead for the Election Results polling firm and has a PSOE of 39.6% 175?
SELECT lead FROM table_name_8 WHERE polling_firm = "election results" AND psoe = "39.6% 175"
sql_create_context
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, ...
SELECT OwnerUserId AS "user_link", OwnerDisplayName, Id AS "post_link" FROM Posts WHERE (NOT OwnerUserId IS NULL) AND (NOT OwnerDisplayName IS NULL) ORDER BY OwnerUserId
sede
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(*) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-4326')) AND treatment.treatmentname = 'non-invasive ventilation' AND STRFTIM...
eicu
CREATE TABLE table_name_66 ( engine VARCHAR, driver VARCHAR, chassis VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the engine driven by Jean-Pierre Jarier and has a chassis of PC4?
SELECT engine FROM table_name_66 WHERE driver = "jean-pierre jarier" AND chassis = "pc4"
sql_create_context
CREATE TABLE table_38781 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the opponent of the game with 33,628 folks in attendance?
SELECT "Opponent" FROM table_38781 WHERE "Attendance" = '33,628'
wikisql
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,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 employees ( EMPLOYE...
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY SUM(DEPARTMENT_ID)
nvbench
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 record ( ID int, Result text, Swimmer_ID int, Event_ID int ) ...
SELECT Time, ID FROM swimmer ORDER BY ID DESC
nvbench
CREATE TABLE table_name_42 ( mpg_uk_combined INTEGER, l_100km_urban__cold_ VARCHAR, mpg_uk_urban__cold_ VARCHAR, l_100km_extra_urban VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the least mpg-UK combined when the mpg-UK urban is 25.4, the L/...
SELECT MIN(mpg_uk_combined) FROM table_name_42 WHERE mpg_uk_urban__cold_ = 25.4 AND l_100km_extra_urban < 6.9 AND l_100km_urban__cold_ > 11.1
sql_create_context
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime...
SELECT t2.drugname FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-19726') AND diagnosis.diagnos...
eicu
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE regions ( REGION_ID...
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(EMPLOYEE_ID)
nvbench
CREATE TABLE table_73810 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the production code f...
SELECT "Production code" FROM table_73810 WHERE "Written by" = 'Theresa Rebeck'
wikisql
CREATE TABLE table_37898 ( "District" text, "Incumbent" text, "Party" text, "First elected" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which District has a Party of republican and a Result of lost re-election democratic gain?
SELECT "District" FROM table_37898 WHERE "Party" = 'republican' AND "Result" = 'lost re-election democratic gain'
wikisql
CREATE TABLE table_33152 ( "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 sum of crowd(s) when north melbourne...
SELECT SUM("Crowd") FROM table_33152 WHERE "Away team" = 'north melbourne'
wikisql
CREATE TABLE table_56336 ( "Player" text, "No.(s)" text, "Height in Ft." text, "Position" text, "School/Club Team/Country" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the height in feet for the guard from north carolina-charlotte
SELECT "Height in Ft." FROM table_56336 WHERE "Position" = 'guard' AND "School/Club Team/Country" = 'north carolina-charlotte'
wikisql
CREATE TABLE table_18220102_1 ( award_winning_film VARCHAR, number_of_screening VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which award-winning film has a screening number of 50 films 50 televised?
SELECT award_winning_film FROM table_18220102_1 WHERE number_of_screening = "50 films 50 televised"
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 T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder, T1.Name ORDER BY T1.Name
nvbench
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime t...
SELECT t4.diagnosisname FROM (SELECT t3.diagnosisname, DENSE_RANK() OVER (ORDER BY t3.c1 DESC) AS c2 FROM (SELECT t2.diagnosisname, 100 - SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 1 * 365 THEN 1 ELSE 0 END) * 10...
eicu
CREATE TABLE table_52003 ( "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 away team score when the crowd is l...
SELECT "Away team score" FROM table_52003 WHERE "Crowd" > '22,000' AND "Home team" = 'hawthorn'
wikisql
CREATE TABLE table_48012 ( "Fin. Pos" text, "Car No." text, "Driver" text, "Team" text, "Laps" text, "Time/Retired" text, "Grid" text, "Laps Led" text, "Points" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the grid number ...
SELECT "Grid" FROM table_48012 WHERE "Points" = '14'
wikisql
CREATE TABLE table_name_38 ( enrollment INTEGER, mascot VARCHAR, year_joined VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average enrollment that has hot dogs as the mascot, with a year joined later than 1926?
SELECT AVG(enrollment) FROM table_name_38 WHERE mascot = "hot dogs" AND year_joined > 1926
sql_create_context
CREATE TABLE table_name_78 ( year VARCHAR, comptroller VARCHAR, party VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many times what the comptroller alan hevesi and the party working families?
SELECT COUNT(year) FROM table_name_78 WHERE comptroller = "alan hevesi" AND party = "working families"
sql_create_context
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "PRED1"
mimicsql_data
CREATE TABLE table_name_40 ( tries INTEGER, points VARCHAR, goals VARCHAR, position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the lowest tries for goals more than 0 with centre position and points less than 54
SELECT MIN(tries) FROM table_name_40 WHERE goals > 0 AND position = "centre" AND points < 54
sql_create_context
CREATE TABLE table_69526 ( "Rank" real, "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 number of bronze medals associated with 0 silver, 1 total, and ranks ove...
SELECT AVG("Bronze") FROM table_69526 WHERE "Total" = '1' AND "Silver" = '0' AND "Rank" > '16'
wikisql
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE cost ( row_id nu...
SELECT patients.gender FROM patients WHERE patients.subject_id = 43052
mimic_iii
CREATE TABLE gwyjzb ( 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 COUNT(*) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_ID = '31337680' AND t_kc22.STA_DATE BETWEEN '2002-03-31' AND '2004-03-01' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' UNION SELECT COUNT(*) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE f...
css
CREATE TABLE table_name_34 ( track VARCHAR, turns VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where is the track located with 18 turns?
SELECT track FROM table_name_34 WHERE turns = "18"
sql_create_context
CREATE TABLE table_69309 ( "Name" text, "Gender" text, "Area" text, "Authority" text, "Decile" real, "Roll" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the largest decile with a Roll larger than 34, a Gender of coed, and an Authority ...
SELECT MAX("Decile") FROM table_69309 WHERE "Roll" > '34' AND "Gender" = 'coed' AND "Authority" = 'state integrated' AND "Area" = 'georgetown'
wikisql
CREATE TABLE table_57515 ( "Date of Issue" text, "Theme" text, "Design" text, "Illustration" text, "Paper Type" text, "First Day Cover Cancellation" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Paper Type with a First Day Cover Can...
SELECT "Paper Type" FROM table_57515 WHERE "First Day Cover Cancellation" = 'ottawa, on'
wikisql
CREATE TABLE SportsInfo ( StuID INTEGER, SportName VARCHAR(32), HoursPerWeek INTEGER, GamesPlayed INTEGER, OnScholarship VARCHAR(1) ) CREATE TABLE Video_Games ( GameID INTEGER, GName VARCHAR(40), GType VARCHAR(40) ) CREATE TABLE Plays_Games ( StuID INTEGER, GameID INTEGER, ...
SELECT GameID, SUM(Hours_Played) FROM Plays_Games GROUP BY GameID
nvbench
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE patients ( row_id number, subj...
SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FR...
mimic_iii
CREATE TABLE 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 (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 = 14962 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND chartev...
mimic_iii
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
SELECT jyjgzbb.SHRGH, jyjgzbb.SHRXM FROM jyjgzbb WHERE jyjgzbb.JYZBLSH = '75463449418'
css
CREATE TABLE course ( crs_code text, dept_code text, crs_description text, crs_credit number ) CREATE TABLE employee ( emp_num number, emp_lname text, emp_fname text, emp_initial text, emp_jobcode text, emp_hiredate time, emp_dob time ) CREATE TABLE professor ( emp_num ...
SELECT COUNT(*), dept_code FROM student GROUP BY dept_code
spider
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.expire_flag = "1" AND prescriptions.drug = "Pantoprazole Sodium"
mimicsql_data
CREATE TABLE table_32545 ( "Region" text, "Host" text, "Venue" text, "City" text, "State" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which region does Old Dominion University represent?
SELECT "Region" FROM table_32545 WHERE "Host" = 'old dominion university'
wikisql
CREATE TABLE table_2429942_2 ( runner_up VARCHAR, season VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the runner-up for the season 2008-09?
SELECT runner_up FROM table_2429942_2 WHERE season = "2008-09"
sql_create_context
CREATE TABLE table_52228 ( "DVD Name" text, "Released" text, "Audio" text, "Aspect Ratio" text, "Duration" text, "Number of Episodes" real, "Num of Discs" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was escape to river cottage releas...
SELECT "Released" FROM table_52228 WHERE "DVD Name" = 'escape to river cottage'
wikisql
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE i...
SELECT admissions.marital_status FROM admissions WHERE admissions.subject_id = 19981 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1
mimic_iii
CREATE TABLE table_15621965_7 ( no INTEGER, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What number identifies Chris Gatling?
SELECT MAX(no) FROM table_15621965_7 WHERE player = "Chris Gatling"
sql_create_context
CREATE TABLE table_15287 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many people attended the game on June 18?
SELECT COUNT("Attendance") FROM table_15287 WHERE "Date" = 'june 18'
wikisql
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE transfers ( row_id number...
SELECT SUM(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 51858)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'fol...
mimic_iii
CREATE TABLE table_name_61 ( starring VARCHAR, network VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the star for the Vara network?
SELECT starring FROM table_name_61 WHERE network = "vara"
sql_create_context
CREATE TABLE table_39356 ( "Outcome" text, "Year" real, "Championship" 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. -- What was the surface for Julie Ha...
SELECT "Surface" FROM table_39356 WHERE "Partner" = 'julie halard' AND "Score in the final" = '6–3, 6–2'
wikisql
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId ...
SELECT Id AS "post_link", CreationDate FROM Posts WHERE ClosedDate IS NULL AND Score = 1 AND AnswerCount = 0 AND CommentCount < 2
sede
CREATE TABLE table_48823 ( "Year" real, "Team" text, "Co-Drivers" text, "Class" text, "Laps" real, "Pos." text, "Class Pos." text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many years was the number of laps 71?
SELECT COUNT("Year") FROM table_48823 WHERE "Laps" = '71'
wikisql
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_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) ...
SELECT Nationality, SUM(ID) FROM swimmer GROUP BY Nationality ORDER BY SUM(ID) DESC
nvbench
CREATE TABLE table_57153 ( "Year" real, "Award ceremony" text, "Category" text, "Nominee" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year was Kristin Chenoweth nominated in the category of outstanding actress in a musical?
SELECT "Award ceremony" FROM table_57153 WHERE "Category" = 'outstanding actress in a musical' AND "Nominee" = 'kristin chenoweth'
wikisql
CREATE TABLE table_43218 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" text, "Finish" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What country has a total of 293?
SELECT "Country" FROM table_43218 WHERE "Total" = '293'
wikisql
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 procedures.long_title FROM procedures WHERE procedures.subject_id = "29541"
mimicsql_data
CREATE TABLE table_name_10 ( pick VARCHAR, year VARCHAR, overall VARCHAR, position VARCHAR, round VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What number was the pick for the position of DT in 1952, after round 1, where the overall was less th...
SELECT pick FROM table_name_10 WHERE position = "dt" AND round > 1 AND overall < 155 AND year = "1952"
sql_create_context
CREATE TABLE table_name_13 ( type VARCHAR, date VARCHAR, satellite VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the type of the gps iif-10 satellite with an unknown date?
SELECT type FROM table_name_13 WHERE date = "unknown" AND satellite = "gps iif-10"
sql_create_context
CREATE TABLE table_name_21 ( lost INTEGER, goals_scored VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What the lost that has less than 10 points and less than 38 goals scored?
SELECT SUM(lost) FROM table_name_21 WHERE goals_scored < 38 AND points < 10
sql_create_context
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.icd9_code = "99813"
mimicsql_data
CREATE TABLE table_name_69 ( week_1 VARCHAR, week_3 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When Alinna D Penta was the cyber girl in week 3, who was the cyber girl in week 1?
SELECT week_1 FROM table_name_69 WHERE week_3 = "alinna d penta"
sql_create_context
CREATE TABLE table_19534677_1 ( material_collected VARCHAR, volume_title VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the total number of material collected for justice league of america by george p rez, vol. 2
SELECT COUNT(material_collected) FROM table_19534677_1 WHERE volume_title = "Justice League of America by George Pérez, Vol. 2"
sql_create_context
CREATE TABLE table_name_84 ( year VARCHAR, play_by_play VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year was the play-by-play for Don Earle?
SELECT year FROM table_name_84 WHERE play_by_play = "don earle"
sql_create_context
CREATE TABLE table_35812 ( "Year" real, "Class" text, "Team" text, "Points" real, "Rank" text, "Wins" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the fewest number of wins for a team ranked 8th with fewer than 32 points in the 350cc c...
SELECT MIN("Wins") FROM table_35812 WHERE "Points" < '32' AND "Class" = '350cc' AND "Rank" = '8th'
wikisql
CREATE TABLE table_29704430_1 ( stolen_ends INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the most stolen ends?
SELECT MAX(stolen_ends) FROM table_29704430_1
sql_create_context
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
SELECT jybgb.BGRQ FROM jybgb WHERE jybgb.BGDH = '11288812225'
css
CREATE TABLE table_77809 ( "Rank" real, "Constituency" text, "Winning party 2007" text, "Swing to gain" real, "LD's place 2007" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the lowest rank when the constituency is edinbu...
SELECT MIN("Rank") FROM table_77809 WHERE "Constituency" = 'edinburgh northern and leith' AND "Swing to gain" < '4.16'
wikisql
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 demographic.discharge_location, demographic.dischtime FROM demographic WHERE demographic.name = "James Sloan"
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 WHERE demographic.insurance = "Government" AND demographic.admission_location = "TRSF WITHIN THIS FACILITY"
mimicsql_data
CREATE TABLE table_name_91 ( friday_shukra__venus_ VARCHAR, tuesday_mangala__mars_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result of Friday that's [ oa a] from sans. a g ra on Tuesday?
SELECT friday_shukra__venus_ FROM table_name_91 WHERE tuesday_mangala__mars_ = "တ္ၚဲ အၚါ [ŋoa əŋɛ̀a] from sans. aṅgāra"
sql_create_context
CREATE TABLE table_69376 ( "Frame size" text, "Width" real, "Height" real, "Mpix" real, "Aspect Ratio" text, "max. fps" real, "max. fps HDRx" real, "lowest possible REDCODE at 24 fps" text, "lowest possible REDCODE at max. fps" text ) -- Using valid SQLite, answer the following que...
SELECT MIN("Width") FROM table_69376 WHERE "Frame size" = '5k' AND "Height" < '2700'
wikisql