instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
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, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
SELECT jybgb.BGDH FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN mzjzjlb_jybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND mzjzjlb_jybgb.YLJGDM = jybgb.YLJGDM AND mzjzjlb_jybgb.BGDH ...
css
CREATE TABLE table_name_66 ( away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score for Footscray when they were the away team?
SELECT away_team AS score FROM table_name_66 WHERE away_team = "footscray"
sql_create_context
CREATE TABLE Nurse ( EmployeeID INTEGER, Name VARCHAR(30), Position VARCHAR(30), Registered BOOLEAN, SSN INTEGER ) CREATE TABLE Undergoes ( Patient INTEGER, Procedures INTEGER, Stay INTEGER, DateUndergoes DATETIME, Physician INTEGER, AssistingNurse INTEGER ) CREATE TABLE Pa...
SELECT Name, COUNT(*) FROM Medication AS T1 JOIN Prescribes AS T2 ON T1.Code = T2.Medication GROUP BY T1.Brand
nvbench
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostHistory ( Id number, Po...
SELECT COUNT(*) FROM Tags WHERE TagName LIKE '%java%'
sede
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT COUNT(*) FROM (SELECT t_kc21.MED_ORG_DEPT_CD FROM t_kc21 JOIN t_kc24 JOIN t_kc21_t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc24.MED_CLINIC_ID AND t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID WHERE t_kc21.MED_SER_ORG_NO = '1011651' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2004-05-20' AND '2018-12-18' GROUP B...
css
CREATE TABLE table_3993 ( "No. in series" text, "No. in season" text, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the production code...
SELECT MIN("Production code") FROM table_3993 WHERE "No. in series" = '96'
wikisql
CREATE TABLE postseason ( year INTEGER, round TEXT, team_id_winner TEXT, league_id_winner TEXT, team_id_loser TEXT, league_id_loser TEXT, wins INTEGER, losses INTEGER, ties INTEGER ) CREATE TABLE player_college ( player_id TEXT, college_id TEXT, year INTEGER ) CREATE TA...
SELECT year, COUNT(year) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings'
nvbench
CREATE TABLE fgwyjzb ( 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 gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_ID = '76364706' AND gwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT >= 3367.94) UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_ID = '76364706' AND fgwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID ...
css
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.short_title = "Malig neo ascend colon"
mimicsql_data
CREATE TABLE table_name_97 ( surface VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the surface on 23 October 2011?
SELECT surface FROM table_name_97 WHERE date = "23 october 2011"
sql_create_context
CREATE TABLE table_30121082_1 ( barony VARCHAR, area__acres__ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the Baronies when the area (in acres) is 276?
SELECT barony FROM table_30121082_1 WHERE area__acres__ = 276
sql_create_context
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT t_kc21.MED_SER_ORG_NO FROM t_kc21 WHERE t_kc21.PERSON_ID = '75834844' GROUP BY t_kc21.MED_SER_ORG_NO ORDER BY COUNT(*) DESC
css
CREATE TABLE university ( affiliation VARCHAR, enrollment INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find the total student enrollment for different affiliation type schools.
SELECT SUM(enrollment), affiliation FROM university GROUP BY affiliation
sql_create_context
CREATE TABLE table_77962 ( "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 total number of bronze when the total is less than 1?
SELECT SUM("Bronze") FROM table_77962 WHERE "Total" < '1'
wikisql
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 DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'red blood cells') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissio...
mimic_iii
CREATE TABLE Course_Authors_and_Tutors ( author_id INTEGER, author_tutor_ATB VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), personal_name VARCHAR(80), middle_name VARCHAR(80), family_name VARCHAR(80), gender_mf VARCHAR(1), address_line_1 VARCHAR(80) ) CREATE TABLE Student...
SELECT author_id, author_tutor_ATB FROM Course_Authors_and_Tutors ORDER BY personal_name
nvbench
CREATE TABLE table_52214 ( "Year" real, "Theme" text, "Artist" text, "Mintage" text, "Issue Price" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What artist had a mintage of 41,828 before year 2002?
SELECT "Artist" FROM table_52214 WHERE "Year" < '2002' AND "Mintage" = '41,828'
wikisql
CREATE TABLE table_204_881 ( id number, "round" number, "date" text, "score" text, "opponent" text, "opponent's score" text, "result" text, "venue" text, "attendance" number, "best on ground" text, "team" text ) -- Using valid SQLite, answer the following questions for the ...
SELECT "opponent" FROM table_204_881 WHERE id = (SELECT id FROM table_204_881 WHERE "opponent" = 'hawthorn') + 1
squall
CREATE TABLE table_52716 ( "Name" text, "Took Office" text, "Left Office" text, "Party" text, "District Residence" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who has Took Office of march 4, 1875?
SELECT "Name" FROM table_52716 WHERE "Took Office" = 'march 4, 1875'
wikisql
CREATE TABLE table_31923 ( "Year" text, "Total matches" real, "Total W-L-H" text, "Singles W-L-H" text, "Points won" real, "Points %" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In 2007, what is the average total matches with points % larger ...
SELECT AVG("Total matches") FROM table_31923 WHERE "Points %" > '33.3' AND "Year" = '2007'
wikisql
CREATE TABLE domain_keyword ( did int, kid int ) CREATE TABLE publication ( abstract varchar, cid int, citation_num int, jid int, pid int, reference_num int, title varchar, year int ) CREATE TABLE domain_publication ( did int, pid int ) CREATE TABLE conference ( ci...
SELECT COUNT(DISTINCT (publication.title)) FROM conference, publication WHERE conference.name = 'VLDB' AND publication.cid = conference.cid
academic
CREATE TABLE table_name_63 ( venue VARCHAR, away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What venue did the away team footscray play at?
SELECT venue FROM table_name_63 WHERE away_team = "footscray"
sql_create_context
CREATE TABLE table_204_822 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- the top ranked nation for total medals won
SELECT "nation" FROM table_204_822 ORDER BY "total" DESC LIMIT 1
squall
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, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
SELECT Posts.Id AS "post_link", Posts.OwnerUserId AS "user_link", Score, ViewCount, Score * 1000 / ViewCount AS "Score per Thousand Views" FROM Posts WHERE Score <= -20 AND PostTypeId = 1 ORDER BY Score * 1000 / ViewCount LIMIT 1000
sede
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, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescription...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "LONG TERM CARE HOSPITAL" AND procedures.short_title = "Form cutan ileoureterost"
mimicsql_data
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, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
SELECT * FROM person_info JOIN hz_info JOIN zyjzjlb JOIN hz_info_zyjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND hz_info_zyjzjlb.JZLSH = zyjzjlb.JZLSH AND hz_info_zyjzjlb.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info_zyjz...
css
CREATE TABLE table_19256 ( "Total#" real, "Series#" real, "Title" text, "Writer" text, "Director" text, "Original air date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which episodes have Patrick Lau as the director and Lisa Holdsworth as the...
SELECT "Title" FROM table_19256 WHERE "Director" = 'Patrick Lau' AND "Writer" = 'Lisa Holdsworth'
wikisql
CREATE TABLE Financial_transactions ( account_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show the account id and the number of transactions for each account
SELECT account_id, COUNT(*) FROM Financial_transactions GROUP BY account_id
sql_create_context
CREATE TABLE table_17323042_11 ( location_attendance VARCHAR, high_assists VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the location and attendance of the game when High Assists were Andre Miller (7)?
SELECT location_attendance FROM table_17323042_11 WHERE high_assists = "Andre Miller (7)"
sql_create_context
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID
nvbench
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 MED_ORG_DEPT_NM, IN_DIAG_DIS_NM, AVG(PERSON_AGE) FROM t_kc21 WHERE MED_SER_ORG_NO = '0671916' GROUP BY MED_ORG_DEPT_NM, IN_DIAG_DIS_NM HAVING AVG(PERSON_AGE) < 30
css
CREATE TABLE table_name_3 ( crowd VARCHAR, home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many people were in the crowd when North Melbourne was the home team?
SELECT crowd FROM table_name_3 WHERE home_team = "north melbourne"
sql_create_context
CREATE TABLE table_17748 ( "District" text, "Counties Represented" text, "Delegate" text, "Party" text, "First Elected" real, "Committee" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the districts represented by the Democratic Party a...
SELECT "District" FROM table_17748 WHERE "Committee" = 'Economic Matters' AND "Party" = 'Democratic'
wikisql
CREATE TABLE table_18703133_6 ( wins INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many wins?
SELECT MAX(wins) FROM table_18703133_6
sql_create_context
CREATE TABLE table_name_68 ( played VARCHAR, goal_difference VARCHAR, goals_against VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of played for the goals against over 44 and a goal difference of 11?
SELECT COUNT(played) FROM table_name_68 WHERE goal_difference = 11 AND goals_against > 44
sql_create_context
CREATE TABLE table_name_61 ( games INTEGER, goals_against VARCHAR, lost VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many games were lost by more than 27 but not more 78 with goals less than 300?
SELECT AVG(games) FROM table_name_61 WHERE lost > 27 AND points < 78 AND goals_against < 300
sql_create_context
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 MED_CLINIC_ID FROM t_kc24 WHERE PERSON_ID = '10815565' AND CLINIC_SLT_DATE BETWEEN '2002-10-02' AND '2017-01-18'
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 d_labitems ( row_id number, itemid number, label text ) CREATE TABLE procedures_icd ( row_id number, subject_id...
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 = 23929)) AND DATETIME(outputevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start o...
mimic_iii
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 * FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '4723266' AND t_kc21.IN_HOSP_DATE BETWEEN '2005-06-17' AND '2018-05-08' EXCEPT SELECT * FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '4723266' AND t_kc21.IN_HOSP_DATE BETWEEN '2005-06-17' AND '2018-05-08' AND t_kc21.MED_ORG_DEPT_NM = '小儿神经外科'
css
CREATE TABLE table_name_54 ( player VARCHAR, total VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What player has a total of 158/
SELECT player FROM table_name_54 WHERE total = "158"
sql_create_context
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 t_kc21.OUT_DIAG_DOC_CD, t_kc21.OUT_DIAG_DOC_NM FROM t_kc21 WHERE t_kc21.PERSON_NM = '郎博延' AND t_kc21.IN_HOSP_DATE BETWEEN '2010-04-15' AND '2011-01-27' GROUP BY t_kc21.OUT_DIAG_DOC_CD ORDER BY COUNT(*) DESC LIMIT 1
css
CREATE TABLE table_name_79 ( location VARCHAR, school VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where is Indian Creek school located?
SELECT location FROM table_name_79 WHERE school = "indian creek"
sql_create_context
CREATE TABLE table_name_70 ( ba__place_ VARCHAR, year VARCHAR, team VARCHAR, bb_ VARCHAR, hbp VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In the year 1992 for the Seibu Lions, the BB + HBP which is larger than 49 was this as a BA (Place)?
SELECT ba__place_ FROM table_name_70 WHERE bb_ + hbp > 49 AND team = "seibu lions" AND year = "1992"
sql_create_context
CREATE TABLE table_name_11 ( hometown VARCHAR, college VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Hometown for Villanova College?
SELECT hometown FROM table_name_11 WHERE college = "villanova"
sql_create_context
CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE ta ( campus_job_id int,...
SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN course_offering ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN cou...
advising
CREATE TABLE table_14598_9 ( literate_persons___percentage_ VARCHAR, females___percentage_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the percentage of all the literate people where females are 73.17?
SELECT literate_persons___percentage_ FROM table_14598_9 WHERE females___percentage_ = "73.17"
sql_create_context
CREATE TABLE train_station ( Train_ID int, Station_ID int ) CREATE TABLE station ( Station_ID int, Name text, Annual_entry_exit real, Annual_interchanges real, Total_Passengers real, Location text, Main_Services text, Number_of_Platforms int ) CREATE TABLE train ( Train_ID ...
SELECT Location, SUM(Number_of_Platforms) FROM station GROUP BY Location
nvbench
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, ...
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27362) AND prescriptions.drug = 'enoxaparin sodium' AND STRFTIME('%y-%m', prescriptions.startdate) = '2104-06' ORDER BY prescriptions.startdate LIMIT 1
mimic_iii
CREATE TABLE table_name_8 ( date VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the game date when the opponent was Houston?
SELECT date FROM table_name_8 WHERE opponent = "houston"
sql_create_context
CREATE TABLE table_26282750_1 ( film_festival VARCHAR, participants_recipients VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Film Festival had participants/recipients of Isao Tomita?
SELECT film_festival FROM table_26282750_1 WHERE participants_recipients = "Isao Tomita"
sql_create_context
CREATE TABLE table_name_67 ( surface VARCHAR, opponent_in_the_final VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the surface that Laura Golarsa and her opponent played on in the final?
SELECT surface FROM table_name_67 WHERE opponent_in_the_final = "laura golarsa"
sql_create_context
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost numb...
SELECT COUNT(*) > 0 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 = 8888)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'gastric gastric...
mimic_iii
CREATE TABLE table_name_65 ( week VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many weeks has the opponent been san francisco 49ers?
SELECT COUNT(week) FROM table_name_65 WHERE opponent = "san francisco 49ers"
sql_create_context
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE requirement ( ...
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN semester...
advising
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREA...
SELECT P.Tags, SUM(P.Score) AS "Suma" FROM Posts AS P GROUP BY P.Tags ORDER BY Suma
sede
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 demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND demographic.diagnosis = "FEMORAL ARTERY THROMBOSIS"
mimicsql_data
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JO...
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID)
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 demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.diagnosis = "HYPERGLYCEMIA;HYPONATREMIA"
mimicsql_data
CREATE TABLE table_77940 ( "Player" text, "Date of Birth" text, "Batting Style" text, "Bowling Style" text, "First Class Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was roshan mahanama born?
SELECT "Date of Birth" FROM table_77940 WHERE "Player" = 'roshan mahanama'
wikisql
CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number...
SELECT YEAR(CreationDate) AS "postyear", CAST(SUM(CASE WHEN PostTypeId = 1 THEN Score ELSE 0 END) AS FLOAT) / SUM(CASE WHEN PostTypeId = 1 THEN 1 ELSE 0 END) AS "q", CAST(SUM(CASE WHEN PostTypeId = 2 THEN Score ELSE 0 END) AS FLOAT) / SUM(CASE WHEN PostTypeId = 2 THEN 1 ELSE 0 END) AS "a", CAST(SUM(Score) AS FLOAT) / S...
sede
CREATE TABLE table_2088 ( "Pick #" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the position of glenn goldup
SELECT "Position" FROM table_2088 WHERE "Player" = 'Glenn Goldup'
wikisql
CREATE TABLE table_35140 ( "Hand" text, "1 credit" text, "2 credits" text, "3 credits" text, "4 credits" text, "5 credits" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is listed for the Hand that has a 1 credit of 1?
SELECT "Hand" FROM table_35140 WHERE "1 credit" = '1'
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_CLINIC_ID text, MED_DIRE_CD tex...
SELECT t_kc21.MED_SER_ORG_NO FROM t_kc21 WHERE t_kc21.PERSON_ID = '71927625' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.SOC_SRT_DIRE_NM = '九味镇心颗粒')
css
CREATE TABLE airlines ( alid integer, name text, iata varchar(2), icao varchar(3), callsign text, country text, active varchar(2) ) CREATE TABLE airports ( apid integer, name text, city text, country text, x real, y real, elevation bigint, iata character varc...
SELECT name, elevation FROM airports WHERE city = 'New York' ORDER BY name DESC
nvbench
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 prescriptions ( subject_id text, hadm_id...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.days_stay > "34"
mimicsql_data
CREATE TABLE table_52780 ( "Place (Posici\u00f3n)" real, "Team (Equipo)" text, "Played (PJ)" real, "Won (PG)" real, "Draw (PE)" real, "Lost (PP)" real, "Goals Scored (GF)" real, "Goals Conceded (GC)" real, "+/- (Dif.)" real, "Points (Pts.)" real ) -- Using valid SQLite, answer ...
SELECT SUM("Points (Pts.)") FROM table_52780 WHERE "Won (PG)" > '9' AND "Goals Scored (GF)" > '40'
wikisql
CREATE TABLE table_37378 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date is the visitor Ottawa?
SELECT "Date" FROM table_37378 WHERE "Visitor" = 'ottawa'
wikisql
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 COUNT(*) FROM (SELECT qtb.MED_ORG_DEPT_CD FROM qtb JOIN t_kc24 ON qtb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE qtb.MED_SER_ORG_NO = '1011651' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2004-05-20' AND '2018-12-18' GROUP BY qtb.MED_ORG_DEPT_CD HAVING SUM(t_kc24.MED_AMOUT) <= 1777.85 UNION SELECT gyb.MED_ORG_DEPT_CD FR...
css
CREATE TABLE table_name_40 ( field_goals INTEGER, touchdowns VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who had the lowest field goals if they had 12 touchdowns and more than 72 points?
SELECT MIN(field_goals) FROM table_name_40 WHERE touchdowns = 12 AND points > 72
sql_create_context
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "81" AND prescriptions.route = "IVPCA"
mimicsql_data
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.admission_type = "ELECTIVE"
mimicsql_data
CREATE TABLE table_2624098_1 ( english_day_name_meaning VARCHAR, modern_english_day_name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many different meanings does Wednesday have?
SELECT COUNT(english_day_name_meaning) FROM table_2624098_1 WHERE modern_english_day_name = "Wednesday"
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 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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "ROSI8"
mimicsql_data
CREATE TABLE table_name_28 ( competition VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For what competition was the game played on 28 March 2009?
SELECT competition FROM table_name_28 WHERE date = "28 march 2009"
sql_create_context
CREATE TABLE table_34056 ( "Date" text, "Label" text, "Region" text, "Format" text, "Catalog" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Region of Catalog 885 973-4?
SELECT "Region" FROM table_34056 WHERE "Catalog" = '885 973-4'
wikisql
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY COUNT(HIRE_DATE)
nvbench
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE diagnosis ( diagnosisid number...
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'analgesics - oral analgesics' AND DATETIME(treatment.treatmenttime) <= DA...
eicu
CREATE TABLE table_26723 ( "Week" real, "Date" text, "Kickoff" text, "Opponent" text, "Final score" text, "Team record" text, "Game site" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date did the team play on we...
SELECT "Date" FROM table_26723 WHERE "Week" = '8'
wikisql
CREATE TABLE table_name_98 ( ties VARCHAR, losses INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of ties a team with less than 3 losses have?
SELECT COUNT(ties) FROM table_name_98 WHERE losses < 3
sql_create_context
CREATE TABLE STUDENT ( Advisor VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Report all advisors that advise more than 2 students.
SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*) > 2
sql_create_context
CREATE TABLE table_24625467_1 ( no VARCHAR, production_code VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What episode number has 2j5352 as a production code?
SELECT no FROM table_24625467_1 WHERE production_code = "2J5352"
sql_create_context
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_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE patients ( row_...
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 29971) AND STRFTIME('%y', procedures_icd.charttime) <= '2103' ORDER BY procedures_icd.charttime LIMIT 1
mimic_iii
CREATE TABLE table_203_871 ( id number, "#" number, "player" text, "pos" text, "pts" number, "tries" number, "conv" number, "pens" number, "drop" number, "opposition" text, "venue" text, "date" text ) -- Using valid SQLite, answer the following questions for the tables ...
SELECT "player" FROM table_203_871 WHERE "pos" <> 'fly-half'
squall
CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, a...
SELECT DISTINCT airline_code FROM airline WHERE airline_code = 'US'
atis
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 = '2465778' AND t_kc21.IN_HOSP_DATE BETWEEN '2006-06-24' AND '2021-01-30' AND t_kc21.PERSON_NM LIKE '姜%'
css
CREATE TABLE table_name_6 ( player VARCHAR, place VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who scored 74-70-67=211 and placed t5?
SELECT player FROM table_name_6 WHERE place = "t5" AND score = 74 - 70 - 67 = 211
sql_create_context
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 medication ( medi...
SELECT MIN(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-71495') AND NOT patient.admissionweight IS NULL AND STRFTIME('%y-%m', patient.unitadmittime) <= '2104-02' GROUP BY STRFTIME('%y-%m-%d', patien...
eicu
CREATE TABLE table_48573 ( "Position" real, "Driver / Passenger" text, "Equipment" text, "Bike No" real, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest Postion, when Bike No is greater than 10, when Driver / Passenger is ...
SELECT MIN("Position") FROM table_48573 WHERE "Bike No" > '10' AND "Driver / Passenger" = 'nicky pulinx / ondrej cermak' AND "Points" > '244'
wikisql
CREATE TABLE table_29565601_2 ( pa INTEGER, pf VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the PA when the PF is 73?
SELECT MIN(pa) FROM table_29565601_2 WHERE pf = 73
sql_create_context
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Medicaid" AND lab.label = "Prostate Specific Antigen"
mimicsql_data
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
SELECT mzjzjlb.JZLSH FROM person_info JOIN hz_info JOIN mzjzjlb 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 WHERE person_info.XM = '云鸿运' AND NOT mzjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ >= '2009-07-30')
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 patient ( uniquep...
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-4987')) AND microlab.culturesite = 'nasopharynx' AND DATETIME...
eicu
CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE ...
SELECT DISTINCT course.department, course.name, course.number, instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.name LIKE '%Gender and Social Science%' AND NOT instructor.name LIKE '%Joyce%' AND offering_instructor.instructor_id ...
advising
CREATE TABLE table_78844 ( "Season" text, "League" text, "Teams" text, "Home" text, "Away" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What season has a regionalliga s d league, a 1-0 home, and an away of 2-3?
SELECT "Season" FROM table_78844 WHERE "League" = 'regionalliga süd' AND "Home" = '1-0' AND "Away" = '2-3'
wikisql
CREATE TABLE table_51480 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many laps did Jo Bonnier driver when the grid number was smaller than 11?
SELECT SUM("Laps") FROM table_51480 WHERE "Driver" = 'jo bonnier' AND "Grid" < '11'
wikisql
CREATE TABLE Transactions_Lots ( transaction_id INTEGER, lot_id INTEGER ) CREATE TABLE Ref_Transaction_Types ( transaction_type_code VARCHAR(10), transaction_type_description VARCHAR(80) ) CREATE TABLE Investors ( investor_id INTEGER, Investor_details VARCHAR(255) ) CREATE TABLE Lots ( lo...
SELECT T1.Investor_details, T1.investor_id FROM Investors AS T1 JOIN Transactions AS T2 ON T1.investor_id = T2.investor_id ORDER BY COUNT(*) DESC LIMIT 3
nvbench
CREATE TABLE table_name_54 ( segment_c VARCHAR, segment_b VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Segment C has a Segment B of fish food?
SELECT segment_c FROM table_name_54 WHERE segment_b = "fish food"
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.short_title = "Hemodialysis"
mimicsql_data
CREATE TABLE table_54970 ( "Country/Region" text, "Languages" text, "Premiere" text, "Seasons" text, "Status" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What country speaks Vietnamese?
SELECT "Country/Region" FROM table_54970 WHERE "Languages" = 'vietnamese'
wikisql
CREATE TABLE table_59162 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the score if the Tie no is 32?
SELECT "Score" FROM table_59162 WHERE "Tie no" = '32'
wikisql