instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
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 lab ( labid numbe...
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-33898')) AND medication.drugname IN ('glucagon hcl (rdna) 1 mg ij solr...
eicu
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description va...
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE area.area LIKE '%human...
advising
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 microlab ( microlabid number, ...
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '007-7925' AND STRFTIME('%y', patient.hospitaladmittime) >= '2103'
eicu
CREATE TABLE table_49719 ( "Year" real, "U.S." text, "U.S. R&B" text, "U.S. Rap" text, "Album" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the U.S. R&B rank in 2003?
SELECT "U.S. R&B" FROM table_49719 WHERE "Year" = '2003'
wikisql
CREATE TABLE table_6753 ( "Version" text, "Length" text, "Album" text, "Remixed by" text, "Year" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who remixed an album of dance remixes?
SELECT "Remixed by" FROM table_6753 WHERE "Album" = 'dance remixes'
wikisql
CREATE TABLE table_39663 ( "Game" real, "February" real, "Opponent" text, "Score" text, "Record" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many February days have Points of 63 and a Score of 1 2?
SELECT COUNT("February") FROM table_39663 WHERE "Points" = '63' AND "Score" = '1–2'
wikisql
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2108" AND procedures.short_title = "Incision of aorta"
mimicsql_data
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, s...
SELECT COUNT(DISTINCT t2.subject_id) FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_di...
mimic_iii
CREATE TABLE Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy INTEGER, basePrice INTEGER, decor TEXT ) CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adul...
SELECT decor, COUNT(*) FROM Rooms WHERE bedType = "King" GROUP BY decor ORDER BY decor
nvbench
CREATE TABLE table_1041 ( "Player" text, "Position" text, "Starter" text, "Touchdowns" real, "Extra points" real, "Field goals" real, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many points were scored by Rolla Bigelow?
SELECT "Points" FROM table_1041 WHERE "Player" = 'Rolla Bigelow'
wikisql
CREATE TABLE table_204_427 ( id number, "creature (other planes)" text, "page" text, "other appearances" text, "variants" text, "description" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the last creature -lrb- other planes -rrb- for p...
SELECT "creature (other planes)" FROM table_204_427 WHERE "page" = 41 ORDER BY id DESC LIMIT 1
squall
CREATE TABLE table_203_521 ( id number, "year" number, "division" number, "league" text, "regular season" text, "playoffs" text, "open cup" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the result of the last playoffs ?
SELECT "playoffs" FROM table_203_521 ORDER BY "year" DESC LIMIT 1
squall
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
SELECT All_Home, School_ID FROM basketball_match GROUP BY ACC_Home, All_Home ORDER BY All_Home DESC
nvbench
CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_season int, Title text, Directed_by text, Original_air_date text, Production_code text ) CREATE TABLE schedule ( Cinema_ID int, Film_ID int, Date text, Show_times_per_day int, Price float ) CREATE TABLE cine...
SELECT Openning_year, AVG(Capacity) FROM cinema ORDER BY Openning_year
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dob_year < "2111" AND diagnoses.short_title = "Injury-hanging"
mimicsql_data
CREATE TABLE table_39180 ( "Date" real, "Opponent" text, "Venue" text, "Result" text, "Attendance" real, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many people attended the away league competition with a date of 22?
SELECT "Attendance" FROM table_39180 WHERE "Competition" = 'league' AND "Venue" = 'away' AND "Date" = '22'
wikisql
CREATE TABLE table_name_6 ( score VARCHAR, high_assists VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Score has High assists of rodriguez (8)?
SELECT score FROM table_name_6 WHERE high_assists = "rodriguez (8)"
sql_create_context
CREATE TABLE table_203_410 ( id number, "game" number, "date" text, "opponent" text, "location" text, "score" text, "attendance" number, "record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many games had at least 5,000 attendees ...
SELECT COUNT("game") FROM table_203_410 WHERE "attendance" >= 5000
squall
CREATE TABLE table_name_3 ( rank INTEGER, bronze VARCHAR, total VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest rank for Spain when more than 10 medals were won, 3 of which were bronze?
SELECT MIN(rank) FROM table_name_3 WHERE bronze = 3 AND total > 10
sql_create_context
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TAB...
SELECT p.Id AS "post_link", p.LastActivityDate FROM Posts AS p INNER JOIN Users AS u ON p.OwnerUserId = u.Id INNER JOIN PostHistory AS h ON p.Id = h.PostId WHERE p.PostTypeId = 2 AND p.OwnerUserId = '##USERID##' AND h.PostHistoryTypeId = '12' ORDER BY p.LastActivityDate DESC
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 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Private" AND diagnoses.short_title = "Schizoaffective dis NOS"
mimicsql_data
CREATE TABLE table_75482 ( "Game" real, "October" real, "Opponent" text, "Score" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the least game for october 21
SELECT MIN("Game") FROM table_75482 WHERE "October" = '21'
wikisql
CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Member_of ( FacID INTEGER, DNO INTEGER, Appt_Type VARCHAR(15) ) CREATE TABLE Minor_in ( StuID INT...
SELECT T1.CName, COUNT(T1.CName) FROM Course AS T1 JOIN Enrolled_in AS T2 ON T1.CID = T2.CID GROUP BY T1.CName, T2.CID HAVING COUNT(*) >= 5 ORDER BY COUNT(T1.CName) DESC
nvbench
CREATE TABLE table_name_20 ( country VARCHAR, to_par VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Country has a To par of 2? Question 2
SELECT country FROM table_name_20 WHERE to_par = "−2"
sql_create_context
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.icd9_code = "3799"
mimicsql_data
CREATE TABLE table_2562572_46 ( largest_ethnic_group__2002_ VARCHAR, settlement VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the largest ethnic group in so ica?
SELECT largest_ethnic_group__2002_ FROM table_2562572_46 WHERE settlement = "Sočica"
sql_create_context
CREATE TABLE table_name_2 ( result VARCHAR, year VARCHAR, round VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result after 1993 of the first four rounds?
SELECT result FROM table_name_2 WHERE year > 1993 AND round = "first four"
sql_create_context
CREATE TABLE table_name_5 ( rank INTEGER, population INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the most rank for population more than 93,378
SELECT MAX(rank) FROM table_name_5 WHERE population > 93 OFFSET 378
sql_create_context
CREATE TABLE table_17558 ( "Number" real, "Name" text, "Titles" text, "Date" text, "Opponent" text, "Result" text, "Defenses" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the date of the match for the lineal super lightweight (140)...
SELECT "Date" FROM table_17558 WHERE "Titles" = 'Lineal Super lightweight (140)'
wikisql
CREATE TABLE table_203_396 ( id number, "year" number, "domestic passengers" number, "international passengers" number, "total passengers" number, "change" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which year saw the highest drop in total p...
SELECT "year" FROM table_203_396 ORDER BY "change" LIMIT 1
squall
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wa...
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '027-24468' AND STRFTIME('%y', patient.hospitaladmittime) >= '2102' ORDER BY patient.hospitaladmittime DESC LIMIT 1
eicu
CREATE TABLE Customers ( customer_id INTEGER, payment_method VARCHAR(15), customer_name VARCHAR(80), customer_phone VARCHAR(80), customer_email VARCHAR(80), customer_address VARCHAR(255), customer_login VARCHAR(80), customer_password VARCHAR(10) ) CREATE TABLE Premises ( premise_id ...
SELECT address_type_code, COUNT(address_type_code) FROM Customer_Addresses AS T1 JOIN Premises AS T2 ON T1.premise_id = T2.premise_id GROUP BY address_type_code
nvbench
CREATE TABLE table_71960 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many gold have a Rank of 7, and a Bronze of 1, and a Silver smaller than 0?
SELECT SUM("Gold") FROM table_71960 WHERE "Rank" = '7' AND "Bronze" = '1' AND "Silver" < '0'
wikisql
CREATE TABLE table_204_850 ( id number, "name" text, "railway" text, "series" text, "maker" text, "dates" text, "drive" text, "wheel arrangement" text, "weight" text, "power" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided ...
SELECT SUM("weight") FROM table_204_850 WHERE "name" IN ('big boy', 'm1')
squall
CREATE TABLE zyjzjlb_jybgb ( YLJGDM_ZYJZJLB text, BGDH number, YLJGDM number ) 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 n...
SELECT * FROM person_info JOIN hz_info JOIN zyjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE person_info.XM = '窦刚毅' AND hz_info.YLJGDM = '3108353' AND zyjzjlb.JZKSMC LIKE '%感染%'
css
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 hz_info JOIN zyjzjlb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND person_info_hz_info.KH = hz_info.KH AND person_info_hz_info.KLX = hz_info.KLX AND person_info_hz_info.YLJGDM = hz_info.YLJGDM AND person_info_hz_i...
css
CREATE TABLE table_26459 ( "Special" text, "Original airdate" text, "Iron Chef" text, "Challenger" text, "Challenger Specialty" text, "Theme Ingredient" text, "Winner" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the winner for the...
SELECT "Winner" FROM table_26459 WHERE "Original airdate" = 'January 5, 2000' AND "Challenger Specialty" = 'French'
wikisql
CREATE TABLE table_57707 ( "Date" text, "Course" text, "Distance" text, "Type" text, "Winner" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When did the course Vasto to Campitello Matese took place?
SELECT "Date" FROM table_57707 WHERE "Course" = 'vasto to campitello matese'
wikisql
CREATE TABLE fzzmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZD...
SELECT jybgb.SHSJ FROM person_info JOIN hz_info JOIN zzmzjzjlb JOIN jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_info.XM = '赵...
css
CREATE TABLE table_3861 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is...
SELECT MAX("Game") FROM table_3861
wikisql
CREATE TABLE table_203_56 ( id number, "star" text, "start\nyear" number, "end\nyear" number, "maximum\nyear" number, "maximum\nmagnitude" number, "distance at\nmaximum (ly)" number, "current\ndistance" number, "current\nmagnitude" number ) -- Using valid SQLite, answer the followi...
SELECT "star" FROM table_203_56 WHERE "distance at\nmaximum (ly)" = 80
squall
CREATE TABLE table_71089 ( "Runs" text, "Player" text, "Opponent" text, "Venue" text, "Season" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the opponent for Andrew Symonds in the 2004 season?
SELECT "Opponent" FROM table_71089 WHERE "Player" = 'andrew symonds' AND "Season" = '2004'
wikisql
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGu...
SELECT CommentCount, AVG(Score) AS AverageScore FROM Posts GROUP BY CommentCount ORDER BY CommentCount
sede
CREATE TABLE broadcast ( Channel_ID int, Program_ID int, Time_of_day text ) CREATE TABLE program ( Program_ID int, Name text, Origin text, Launch real, Owner text ) CREATE TABLE channel ( Channel_ID int, Name text, Owner text, Share_in_percent real, Rating_in_percen...
SELECT Time_of_day, COUNT(*) FROM broadcast GROUP BY Time_of_day
nvbench
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 MAX(vitalperiodic.respiration) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '032-2747')) AND NOT vitalperiodic.respiration IS N...
eicu
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 (SELECT SUM(STA_FLG) FROM t_kc22 WHERE MED_CLINIC_ID = '32600850724') = (SELECT COUNT(*) FROM t_kc22 WHERE MED_CLINIC_ID = '32600850724')
css
CREATE TABLE table_50176 ( "Radical (variants)" text, "Stroke count" real, "P\u012bny\u012bn" text, "Hiragana - Romaji" text, "Meaning" text, "Frequency" real, "Examples" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT IS THE MEANING WIT...
SELECT "Meaning" FROM table_50176 WHERE "P\u012bny\u012bn" = 'chē'
wikisql
CREATE TABLE mzjzjlb ( YLJGDM text, JZLSH text, KH text, KLX number, MJZH text, HZXM text, NLS number, NLY number, ZSEBZ number, JZZTDM number, JZZTMC text, JZJSSJ time, TXBZ number, ZZBZ number, WDBZ number, JZKSBM text, JZKSMC text, JZKSRQ time, ...
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jy...
css
CREATE TABLE party ( YEAR VARCHAR, Governor VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In which distinct years was the governor 'Eliot Spitzer'?
SELECT DISTINCT YEAR FROM party WHERE Governor = "Eliot Spitzer"
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code tex...
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'anxiety' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2104') AS t1 JOIN (SELECT patient.uniquepid, medica...
eicu
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 SUM(t_kc22.AMOUNT) FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_NM = '杨芳洁' AND t_kc21.CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2000-11-30' AND '2008-07-05' AND t_kc22.MED_INV_IT...
css
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_care...
SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10855)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.lab...
mimic_iii
CREATE TABLE table_67099 ( "Player" text, "Years" text, "Games played" real, "Goals allowed" real, "Goals against average" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who played 44 games who averaged over 2.07 goals against?
SELECT "Player" FROM table_67099 WHERE "Goals against average" > '2.07' AND "Games played" = '44'
wikisql
CREATE TABLE table_19559 ( "School Year" text, "Class A" text, "Class AA" text, "Class AAA" text, "Class AAAA" text, "Class AAAAA" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which is the class A when Marion was the class AA
SELECT "Class A" FROM table_19559 WHERE "Class AA" = 'Marion'
wikisql
CREATE TABLE table_31752 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Venue" text, "Start Time" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the start time for december 24, 2005
SELECT "Start Time" FROM table_31752 WHERE "Date" = 'december 24, 2005'
wikisql
CREATE TABLE film ( Film_ID int, Title text, Studio text, Director text, Gross_in_dollar int ) CREATE TABLE film_market_estimation ( Estimation_ID int, Low_Estimate real, High_Estimate real, Film_ID int, Type text, Market_ID int, Year int ) CREATE TABLE market ( Mar...
SELECT Studio, COUNT(*) FROM film GROUP BY Studio ORDER BY Studio DESC
nvbench
CREATE TABLE table_62858 ( "Athlete" text, "Class" text, "Horse" text, "Event" text, "Result" text, "Rank" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What horse has a 66.452 result?
SELECT "Horse" FROM table_62858 WHERE "Result" = '66.452'
wikisql
CREATE TABLE table_26296 ( "Rank" real, "Company Name" text, "2008 Rank" text, "2009 Revenue" text, "North American Brands" text, "World Headquarters" text, "Country" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which rank has a 2009 reven...
SELECT "Rank" FROM table_26296 WHERE "2009 Revenue" = '$296,000,000'
wikisql
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiolo...
SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t2.charttime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id...
mimic_iii
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number...
SELECT 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 = '006-71495')) AND DATETIME(treatment.treatmenttime) <= DATETIME(CU...
eicu
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND lab.fluid = "Urine"
mimicsql_data
CREATE TABLE table_30058355_2 ( thurs_25_aug VARCHAR, fri_26_aug VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What shows for thurs 25 aug when fri 26 aug is 19' 30.70 116.023mph?
SELECT thurs_25_aug FROM table_30058355_2 WHERE fri_26_aug = "19' 30.70 116.023mph"
sql_create_context
CREATE TABLE table_name_94 ( engine VARCHAR, driver VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What engine does driver james hunt have?
SELECT engine FROM table_name_94 WHERE driver = "james hunt"
sql_create_context
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varc...
SELECT HIRE_DATE, SALARY FROM employees ORDER BY HIRE_DATE
nvbench
CREATE TABLE table_name_76 ( film VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What film was released in 1996?
SELECT film FROM table_name_76 WHERE year = 1996
sql_create_context
CREATE TABLE table_name_27 ( ihsaa_class VARCHAR, school VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the IHSAA class for Muncie Cowan?
SELECT ihsaa_class FROM table_name_27 WHERE school = "muncie cowan"
sql_create_context
CREATE TABLE Shipment_Items ( shipment_id INTEGER, order_item_id INTEGER ) CREATE TABLE Orders ( order_id INTEGER, customer_id INTEGER, order_status VARCHAR(10), date_order_placed DATETIME, order_details VARCHAR(255) ) CREATE TABLE Invoices ( invoice_number INTEGER, invoice_date DA...
SELECT COUNT(*), T2.product_id FROM Orders AS T1 JOIN Order_Items AS T2 JOIN Products AS T3 ON T1.order_id = T2.order_id AND T2.product_id = T3.product_id GROUP BY T3.product_id
nvbench
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), ...
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY JOB_ID
nvbench
CREATE TABLE table_name_49 ( losses VARCHAR, ties VARCHAR, poll_wins VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the number of losses that have Ties of 1 and 3 or more poll wins?
SELECT COUNT(losses) FROM table_name_49 WHERE ties = 1 AND poll_wins > 3
sql_create_context
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id nu...
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 = 19427 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admit...
mimic_iii
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 demographic.admission_type, demographic.days_stay FROM demographic WHERE demographic.name = "Lue White"
mimicsql_data
CREATE TABLE table_name_48 ( shirt_sponsor VARCHAR, kitmaker VARCHAR, head_coach VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the shirt sponsor for the team with a head coach of andre schubert and a kitmaker of puma?
SELECT shirt_sponsor FROM table_name_48 WHERE kitmaker = "puma" AND head_coach = "andre schubert"
sql_create_context
CREATE TABLE table_11614581_3 ( population VARCHAR, _in_thousands VARCHAR, __1905__ VARCHAR, seat VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What population (in thousands) is Lublin's seat?
SELECT population, _in_thousands, __1905__ FROM table_11614581_3 WHERE seat = "Lublin"
sql_create_context
CREATE TABLE table_60234 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Results" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest First Elected, when Results is 'Re-elected', and when Incumbent is 'Lincol...
SELECT MAX("First elected") FROM table_60234 WHERE "Results" = 're-elected' AND "Incumbent" = 'lincoln davis'
wikisql
CREATE TABLE employment ( Company_ID int, People_ID int, Year_working int ) CREATE TABLE company ( Company_ID real, Name text, Headquarters text, Industry text, Sales_in_Billion real, Profits_in_Billion real, Assets_in_Billion real, Market_Value_in_Billion real ) CREATE TAB...
SELECT Headquarters, COUNT(*) FROM company GROUP BY Headquarters ORDER BY Headquarters
nvbench
CREATE TABLE station ( station_id number, name text, annual_entry_exit number, annual_interchanges number, total_passengers number, location text, main_services text, number_of_platforms number ) CREATE TABLE train ( train_id number, name text, time text, service text ) ...
SELECT T2.name, COUNT(*) FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id
spider
CREATE TABLE table_train_34 ( "id" int, "gender" string, "allergy_to_adhesive" bool, "contraception" bool, "use_of_cyclosporin" bool, "use_of_digoxin" bool, "liver_disease" bool, "rhabomyolysis" bool, "allergy_to_hydrocortisone" bool, "use_of_statins" bool, "NOUSE" float ) ...
SELECT * FROM table_train_34 WHERE allergy_to_hydrocortisone = 1 OR allergy_to_adhesive = 1
criteria2sql
CREATE TABLE mzjybgb ( 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 jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN mzjzjlb JOIN zyjybgb JOIN jyjgzbb ON 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.YLJGDM = jyjgzbb.YLJGDM AND zyjybgb...
css
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 person_info_hz_info ( RYBH text, ...
SELECT mzjzjlb.YLJGDM FROM hz_info JOIN mzjzjlb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND person_info_hz_info.KH = hz_info.KH AND person_info_hz_info.KLX = hz_info.KLX AND person_info_hz_info.YLJGDM = hz_info.YLJGDM AND per...
css
CREATE TABLE table_name_40 ( variant_id VARCHAR, genbank_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Variant id has the GenBank id of nm_005411.4?
SELECT variant_id FROM table_name_40 WHERE genbank_id = "nm_005411.4"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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, ...
SELECT zyjybgb.SQKS, zyjybgb.SQKSMC FROM zyjybgb WHERE zyjybgb.BGDH = '35605162695' UNION SELECT mzjybgb.SQKS, mzjybgb.SQKSMC FROM mzjybgb WHERE mzjybgb.BGDH = '35605162695'
css
CREATE TABLE table_79040 ( "Name" text, "Circuit" text, "Date" text, "Winning driver" text, "Winning constructor" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Date has a Name of thuin circuit?
SELECT "Date" FROM table_79040 WHERE "Name" = 'thuin circuit'
wikisql
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 Name, Price FROM Products WHERE Price BETWEEN 60 AND 120
nvbench
CREATE TABLE table_203_741 ( id number, "season" text, "competition" text, "round" text, "opponent" text, "home" text, "away" text, "aggregate" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the first season listed on the table ?...
SELECT "season" FROM table_203_741 WHERE id = 1
squall
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABL...
SELECT admissions.subject_id FROM admissions WHERE admissions.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'pressure ulcer,stage iii') AND DATETIME(diagnoses_icd.charttime) <= DATETI...
mimic_iii
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE job_history ( EMPLOYEE...
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID
nvbench
CREATE TABLE table_1473672_2 ( pick__number INTEGER, college_junior_club_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the pick# for the medicine hat tigers (wchl)?
SELECT MIN(pick__number) FROM table_1473672_2 WHERE college_junior_club_team = "Medicine Hat Tigers (WCHL)"
sql_create_context
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 zzmzjzjlb.JZLSH FROM hz_info JOIN zzmzjzjlb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX WHERE hz_info.RYBH = '64012281' AND hz_info.YLJGDM = '9057855' AND zzmzjzjlb.JZKSMC LIKE '%男科%' UNION SELECT fzzmzjzjlb.JZLSH FROM hz_info JOIN fzzmzjzjlb ON hz_info.YLJG...
css
CREATE TABLE table_52241 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the method for the resolution of the fight...
SELECT "Method" FROM table_52241 WHERE "Event" = 'ufc 160'
wikisql
CREATE TABLE table_59549 ( "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 Home team of Tie no 2?
SELECT "Home team" FROM table_59549 WHERE "Tie no" = '2'
wikisql
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.insurance = "Self Pay" AND procedures.long_title = "Monitoring of cardiac output by other technique"
mimicsql_data
CREATE TABLE table_40083 ( "Round" real, "Location" text, "Circuit" text, "Date" text, "Winning Driver" text, "Winning Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the driver that one for the winning tpc team qi-meritus that has a...
SELECT "Winning Driver" FROM table_40083 WHERE "Winning Team" = 'tpc team qi-meritus' AND "Round" > '8'
wikisql
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL v...
SELECT JOB_ID, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY JOB_ID DESC
nvbench
CREATE TABLE table_43096 ( "Week" real, "Date" text, "Opponent" text, "Time" text, "Game Site" text, "Result/Score" text, "Record" text, "Match Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result/score that has 6-5 ...
SELECT "Result/Score" FROM table_43096 WHERE "Record" = '6-5'
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 SOC_SRT_DIRE_CD, SOC_SRT_DIRE_NM FROM t_kc22 WHERE MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_ID = '04270747' AND MED_SER_ORG_NO = '7760452' AND IN_HOSP_DATE BETWEEN '2000-03-02' AND '2009-09-13')
css
CREATE TABLE table_10487 ( "Retail name" text, "Chipset based on" text, "Digital/analog signal" text, "AVIVO" text, "Available interface" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Chipset based on with a Digital/analog signal of ana...
SELECT "Chipset based on" FROM table_10487 WHERE "Digital/analog signal" = 'analog' AND "Available interface" = 'agp' AND "Retail name" = 'all-in-wonder 9800'
wikisql
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 * FROM person_info JOIN hz_info JOIN zyjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE person_info.XM = '水沛珊' AND hz_info.YLJGDM = '2298626' AND NOT zyjzjlb.JZKSMC LIKE '%咨询%'
css
CREATE TABLE table_1322904_1 ( release VARCHAR, title VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the release date of Sonic Adventure 2?
SELECT release FROM table_1322904_1 WHERE title = "Sonic Adventure 2"
sql_create_context
CREATE TABLE table_3981 ( "Series #" real, "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. -- What episode in the series is 'teased...
SELECT MAX("Series #") FROM table_3981 WHERE "Title" = 'Teased'
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2148.0" AND procedures.short_title = "Percu endosc gastrostomy"
mimicsql_data