instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )...
SELECT (SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-161415' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1) AND NOT patient.admissionweight IS NULL O...
eicu
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.dod_year <= "2174.0" AND prescriptions.formulary_drug_cd = "OSEL75"
mimicsql_data
CREATE TABLE table_67243 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What chassis has a year of 1951?
SELECT "Chassis" FROM table_67243 WHERE "Year" = '1951'
wikisql
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE medication ( medicationid ...
SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-17866')) AND lab.labname = 'fio2' AND STRFTIME('%y', lab.labresulttime) = '2105'
eicu
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2144" AND diagnoses.icd9_code = "28802"
mimicsql_data
CREATE TABLE table_12434380_1 ( institution VARCHAR, mascot VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the institution with the mascot of blue devils?
SELECT institution FROM table_12434380_1 WHERE mascot = "Blue Devils"
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.BBCJBW FROM person_info JOIN hz_info JOIN wdmzjzjlb JOIN jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_info.XM = ...
css
CREATE TABLE table_203_247 ( id number, "district" text, "counties represented" text, "delegate" text, "party" text, "first elected" number, "committee" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many delegates represented allegany ?...
SELECT COUNT("delegate") FROM table_203_247 WHERE "counties represented" = 'allegany'
squall
CREATE TABLE table_name_12 ( title VARCHAR, catalog__number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What CD has a catalog # of PCR 502?
SELECT title FROM table_name_12 WHERE catalog__number = "pcr 502"
sql_create_context
CREATE TABLE table_80170 ( "Election" text, "1st Member" text, "1st Party" text, "2nd Member" text, "2nd Party" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the 2nd Party that had the 2nd Member John Barneby, when the 1st Party was Conser...
SELECT "2nd Party" FROM table_80170 WHERE "2nd Member" = 'john barneby' AND "1st Party" = 'conservative'
wikisql
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid nu...
SELECT MAX(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'adv eff insulin/antidiab') AND STRFTIME('%y', diagnoses_icd.charttime) <= '2104' GROUP BY STRFTIME('%y...
mimic_iii
CREATE TABLE table_5620 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On what date was the record 4 0 0?
SELECT "Date" FROM table_5620 WHERE "Record" = '4–0–0'
wikisql
CREATE TABLE table_20996923_20 ( date VARCHAR, city VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the date when the city is San Antonio, Texas?
SELECT date FROM table_20996923_20 WHERE city = "San Antonio, Texas"
sql_create_context
CREATE TABLE table_19751479_4 ( fastest_lap VARCHAR, rnd VARCHAR, pole_position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many races had #99 gainsco/bob stallings racing in round 10?
SELECT COUNT(fastest_lap) FROM table_19751479_4 WHERE rnd = 10 AND pole_position = "#99 GAINSCO/Bob Stallings Racing"
sql_create_context
CREATE TABLE table_name_8 ( cover_model VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Cover Model was featured on 8-03?
SELECT cover_model FROM table_name_8 WHERE date = "8-03"
sql_create_context
CREATE TABLE table_76600 ( "Year" real, "Starts" real, "Wins" real, "Top 10" real, "Avg. Start" real, "Avg. Finish" real, "Winnings" text, "Position" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many starts for an average finish gr...
SELECT SUM("Starts") FROM table_76600 WHERE "Avg. Finish" > '43'
wikisql
CREATE TABLE table_43630 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Time, when Round is less than 2, and when O...
SELECT "Time" FROM table_43630 WHERE "Round" < '2' AND "Opponent" = 'valentijn overeem'
wikisql
CREATE TABLE table_43168 ( "Name" text, "Position" text, "Number" text, "School/Club Team" text, "Season" text, "Acquisition via" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Season with an Acquisition via of rookie draft, and the ...
SELECT "Season" FROM table_43168 WHERE "Acquisition via" = 'rookie draft' AND "Number" = '15'
wikisql
CREATE TABLE table_name_95 ( winning_constructor VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Constructor won the Roussillon Grand Prix?
SELECT winning_constructor FROM table_name_95 WHERE name = "roussillon grand prix"
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 qtb.OUT_DIAG_DOC_CD, qtb.OUT_DIAG_DOC_NM FROM qtb WHERE qtb.PERSON_NM = '朱淑兰' AND qtb.IN_HOSP_DATE BETWEEN '2001-07-24' AND '2018-09-06' GROUP BY qtb.OUT_DIAG_DOC_CD ORDER BY COUNT(*) DESC LIMIT 1 UNION SELECT gyb.OUT_DIAG_DOC_CD, gyb.OUT_DIAG_DOC_NM FROM gyb WHERE gyb.PERSON_NM = '朱淑兰' AND gyb.IN_HOSP_DATE BETW...
css
CREATE TABLE table_54492 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When the Score was 4-10, what was the Attendance?
SELECT "Attendance" FROM table_54492 WHERE "Score" = '4-10'
wikisql
CREATE TABLE table_50174 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the To par for the player whose final score was 67-71=138?
SELECT "To par" FROM table_50174 WHERE "Score" = '67-71=138'
wikisql
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
SELECT KH, KLX FROM zyjzjlb WHERE JZLSH = '17934842650'
css
CREATE TABLE table_2679061_2 ( pick__number INTEGER, nhl_team VARCHAR, college_junior_club_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the pick # when the nhl team is montreal canadiens and the college/junior/club team is trois-rivi res d...
SELECT MIN(pick__number) FROM table_2679061_2 WHERE nhl_team = "Montreal Canadiens" AND college_junior_club_team = "Trois-Rivières Draveurs (QMJHL)"
sql_create_context
CREATE TABLE table_46666 ( "Position" real, "Team" text, "Played" real, "Drawn" real, "Lost" real, "Goals For" real, "Goals Against" real, "Goal Average 1" real, "Points 2" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For a team wi...
SELECT AVG("Lost") FROM table_46666 WHERE "Goals Against" < '58' AND "Position" = '10' AND "Points 2" > '53'
wikisql
CREATE TABLE table_dev_38 ( "id" int, "gender" string, "serum_potassium" float, "systolic_blood_pressure_sbp" int, "creatinine_clearance_cl" float, "estimated_glomerular_filtration_rate_egfr" int, "diastolic_blood_pressure_dbp" int, "ace_inhibitors" bool, "serum_creatinine" float, ...
SELECT * FROM table_dev_38 WHERE (serum_creatinine >= 1.5 AND gender = 'male') OR (serum_creatinine >= 1.4 AND gender = 'female') OR creatinine_clearance_cl < 60
criteria2sql
CREATE TABLE table_51472 ( "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 score of the home team that played C...
SELECT "Home team score" FROM table_51472 WHERE "Away team" = 'collingwood'
wikisql
CREATE TABLE table_203_824 ( id number, "pick #" number, "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. -- the most players picked came from which n...
SELECT "nationality" FROM table_203_824 GROUP BY "nationality" ORDER BY COUNT("player") DESC LIMIT 1
squall
CREATE TABLE table_31285 ( "Film Festival" text, "Date of ceremony" text, "Category" text, "Participants/Recipients" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which films participated in the 30th Hawaii International Film Festiva...
SELECT "Participants/Recipients" FROM table_31285 WHERE "Film Festival" = '30th Hawaii International Film Festival'
wikisql
CREATE TABLE table_9299 ( "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 much Gold has a Silver smaller than 14, and a Rank larger than 8, and a Bronze of 3?
SELECT COUNT("Gold") FROM table_9299 WHERE "Silver" < '14' AND "Rank" > '8' AND "Bronze" = '3'
wikisql
CREATE TABLE table_name_82 ( ratings__5_capital_cities_ VARCHAR, episode_no VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the rating of the episode Wonder Drug?
SELECT ratings__5_capital_cities_ FROM table_name_82 WHERE episode_no = "wonder drug"
sql_create_context
CREATE TABLE table_56898 ( "Week" real, "EASTERN #1" text, "Eastern #2" text, "WESTERN #1" text, "Western #2" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the eastern #2 for western #2 of oakland
SELECT "Eastern #2" FROM table_56898 WHERE "Western #2" = 'oakland'
wikisql
CREATE TABLE table_44238 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Attendance" real, "Record" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who visited on march 26?
SELECT "Visitor" FROM table_44238 WHERE "Date" = 'march 26'
wikisql
CREATE TABLE table_name_32 ( agency VARCHAR, birthday VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the agency of the member born on 1998.11.09?
SELECT agency FROM table_name_32 WHERE birthday = "1998.11.09"
sql_create_context
CREATE TABLE table_name_6 ( losses INTEGER, against VARCHAR, wins VARCHAR, club VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of losses when wins is more than 6, club is camperdown and against is more than 1238?
SELECT SUM(losses) FROM table_name_6 WHERE wins > 6 AND club = "camperdown" AND against > 1238
sql_create_context
CREATE TABLE table_1566848_7 ( pictorials VARCHAR, centerfold_model VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who were all the pictorials when the centerfold model was Rebekka Armstrong?
SELECT COUNT(pictorials) FROM table_1566848_7 WHERE centerfold_model = "Rebekka Armstrong"
sql_create_context
CREATE TABLE table_name_90 ( period VARCHAR, country VARCHAR, peak_position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the period for south korea with peak position of #1
SELECT period FROM table_name_90 WHERE country = "south korea" AND peak_position = "#1"
sql_create_context
CREATE TABLE table_12982 ( "Week 1" text, "Week 2" text, "Week 3" text, "Week 4" text, "Week 5" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Week 4 has a Week 2 of samantha speer?
SELECT "Week 4" FROM table_12982 WHERE "Week 2" = 'samantha speer'
wikisql
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
SELECT DISTINCT course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (course.number = 487 OR course.number = 521) AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 INNER JOIN course AS COURSEalias1 ON ...
advising
CREATE TABLE table_38605 ( "Team" text, "Recopa 1995" text, "Supercopa 1995" text, "CONMEBOL 1995" text, "Copa Libertadores 1996" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which Copa Libertadores 1996 has round 1 Supercopa 1995 and argentinos j...
SELECT "Copa Libertadores 1996" FROM table_38605 WHERE "Supercopa 1995" = 'round 1' AND "Team" = 'argentinos juniors'
wikisql
CREATE TABLE table_67107 ( "Date" text, "Visiting Team" text, "Final Score" text, "Host Team" text, "Stadium" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the date for visiting team of denver broncos
SELECT "Date" FROM table_67107 WHERE "Visiting Team" = 'denver broncos'
wikisql
CREATE TABLE table_7818 ( "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 wa...
SELECT COUNT("Game") FROM table_7818 WHERE "Team" = 'charlotte'
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 JOB_TITLE, COUNT(JOB_TITLE) FROM employees AS T1 JOIN jobs AS T2 ON T1.JOB_ID = T2.JOB_ID WHERE T1.DEPARTMENT_ID = 80 GROUP BY JOB_TITLE
nvbench
CREATE TABLE table_9624 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was Fuzzy Zoeller's score in the United States?
SELECT "Score" FROM table_9624 WHERE "Country" = 'united states' AND "Player" = 'fuzzy zoeller'
wikisql
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 gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_NM = '周哲彦' AND gwyjzb.MED_SER_ORG_NO = '0211238' AND NOT gwyjzb.IN_DIAG_DIS_NM LIKE '%包括%' UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '周哲彦' AND fgwyjzb.MED_SER_ORG_NO = '0211238' AND NOT fgwyjzb.IN_DIAG_DIS_NM LIKE '%包括%'
css
CREATE TABLE table_203_79 ( id number, "year" number, "film" text, "publisher" text, "director" text, "distributor" text, "worldwide gross" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the number of live action am...
SELECT COUNT("film") FROM table_203_79 WHERE "year" = 1978
squall
CREATE TABLE ftxmzjzjlb ( 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 COUNT(*) FROM (SELECT jybgb.KSBM FROM txmzjzjlb JOIN jybgb ON txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE txmzjzjlb.YLJGDM = '0002177' AND jybgb.BGRQ BETWEEN '2002-06-17' AND '2007-12-06' GROUP BY jybgb.KSBM HAVING COUNT(*) < 23 UNION SELECT jybgb.KSBM FROM ftxmzjzjlb ...
css
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod tim...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'rufinamide' AND STRFTIME('%y', prescriptions.startdate) <= '2101'...
mimic_iii
CREATE TABLE table_19834691_4 ( timeslot VARCHAR, _number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- name the total number of timeslot for number 1
SELECT COUNT(timeslot) FROM table_19834691_4 WHERE _number = 1
sql_create_context
CREATE TABLE table_name_66 ( bronze INTEGER, total VARCHAR, gold VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the low bronze total for the team with 4 total and under 1 gold?
SELECT MIN(bronze) FROM table_name_66 WHERE total = 4 AND gold < 1
sql_create_context
CREATE TABLE instructor ( ID varchar(5), name varchar(20), dept_name varchar(20), salary numeric(8,2) ) CREATE TABLE prereq ( course_id varchar(8), prereq_id varchar(8) ) CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varchar(20), tot_cred numeric(3,0) ) CRE...
SELECT dept_name, MIN(salary) FROM instructor GROUP BY dept_name ORDER BY dept_name
nvbench
CREATE TABLE table_35545 ( "Series Ep." text, "Episode" real, "Netflix" text, "Segment A" text, "Segment B" text, "Segment C" text, "Segment D" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the B segmint for Netlix S03E01?
SELECT "Segment B" FROM table_35545 WHERE "Netflix" = 's03e01'
wikisql
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_re...
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'ATLANTA' AND ground_service.city_code = city.city_code
atis
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
SELECT SUBSTRING(Body, CHARINDEX(@stEnd, Body) + LEN(@stStart) - (CHARINDEX(REVERSE(@stStart), REVERSE(LEFT(Body, CHARINDEX(@stEnd, Body) + LEN(@stStart) - 1))) + LEN(@stStart) - 1), CHARINDEX(REVERSE(@stStart), REVERSE(LEFT(Body, CHARINDEX(@stEnd, Body) + LEN(@stStart) - 1))) + LEN(@stStart) - 1) AS "gif_url", CASE WH...
sede
CREATE TABLE table_76990 ( "Title" text, "Lyricist(s)" text, "Composer(s)" text, "Arranger(s)" text, "Length" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the arranger of ' '?
SELECT "Arranger(s)" FROM table_76990 WHERE "Title" = 'ขอโทษ'
wikisql
CREATE TABLE table_52371 ( "Party" text, "Leader" text, "Votes" real, "Percentage" text, "Seats" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which highest number of Seats has votes of 244,867?
SELECT MAX("Seats") FROM table_52371 WHERE "Votes" = '244,867'
wikisql
CREATE TABLE hz_info_zyjzjlb ( JZLSH number, YLJGDM number, zyjzjlb_id 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 ...
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 table_62049 ( "Date" text, "Opponent" text, "Venue" text, "Result" text, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When did the peterborough phantoms play at a venue of home?
SELECT "Date" FROM table_62049 WHERE "Venue" = 'home' AND "Opponent" = 'peterborough phantoms'
wikisql
CREATE TABLE patient ( ssn number, name text, address text, phone text, insuranceid number, pcp number ) CREATE TABLE medication ( code number, name text, brand text, description text ) CREATE TABLE prescribes ( physician number, patient number, medication number, ...
SELECT COUNT(*), T1.blockfloor FROM block AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockfloor
spider
CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments ...
SELECT DISTINCT course_offering.end_time, course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.start_time, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM course, course_offering, semester WHERE course.course_id = course_offe...
advising
CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT t_kc21.MED_SER_ORG_NO FROM t_kc21 WHERE t_kc21.PERSON_NM = '花淑华' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.SOC_SRT_DIRE_CD = '603623-l')
css
CREATE TABLE table_name_14 ( prohibition_ticket VARCHAR, progressive_ticket VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What name ran for the Prohibition ticket when the Progressive ticket was Eugene M. Travis?
SELECT prohibition_ticket FROM table_name_14 WHERE progressive_ticket = "eugene m. travis"
sql_create_context
CREATE TABLE table_name_48 ( proto_oceanic VARCHAR, proto_polynesian VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Proto-Oceanic has a Proto-Polynesian of *lima?
SELECT proto_oceanic FROM table_name_48 WHERE proto_polynesian = "*lima"
sql_create_context
CREATE TABLE table_41538 ( "Position" real, "Team" text, "Points" real, "Played" real, "Drawn" real, "Lost" real, "Against" real, "Difference" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average number of drawn with a diff...
SELECT AVG("Drawn") FROM table_41538 WHERE "Difference" = '17' AND "Points" = '22'
wikisql
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, ...
SELECT diagnosis.diagnosisname FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-7988')) AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CUR...
eicu
CREATE TABLE table_36079 ( "Name" text, "Species Specific" text, "Intra-molecular structure" text, "Comparative" text, "Link" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Species Specific has a Comparative of no, and an Intra-molecular struc...
SELECT "Species Specific" FROM table_36079 WHERE "Comparative" = 'no' AND "Intra-molecular structure" = 'no' AND "Link" = 'sourcecode'
wikisql
CREATE TABLE table_70973 ( "Round" real, "Overall" real, "Player" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest overall with more than 17 rounds?
SELECT MIN("Overall") FROM table_70973 WHERE "Round" > '17'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) CREATE TABLE person_info ( RYBH text, XBDM number, XBMC text, XM text, CSRQ time, CSD text, MZDM text, MZMC text, GJDM text, GJMC text, JGDM text, JGMC text, XLDM text, XLMC text...
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM mzjzjlb JOIN jybgb JOIN jyjgzbb ON mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE mzjzjlb.JZZDSM = '慢性咽炎' AND jyjgzbb.JCZBDM = '487632'
css
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, ...
SELECT admissions.marital_status FROM admissions WHERE admissions.subject_id = 19894 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1
mimic_iii
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) 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, lan...
SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'white blood cells') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 92788 AND admissions.dischtime IS NULL) ORDER BY labevents.chartti...
mimic_iii
CREATE TABLE drivers ( driverId INTEGER, driverRef TEXT, number TEXT, code TEXT, forename TEXT, surname TEXT, dob TEXT, nationality TEXT, url TEXT ) CREATE TABLE pitStops ( raceId INTEGER, driverId INTEGER, stop INTEGER, lap INTEGER, time TEXT, duration TEXT,...
SELECT name, COUNT(name) FROM constructors AS T1 JOIN constructorStandings AS T2 ON T1.constructorId = T2.constructorId WHERE T1.nationality = "Japanese" AND T2.points > 5 GROUP BY name ORDER BY name
nvbench
CREATE TABLE table_name_70 ( first_class_team VARCHAR, date_of_birth VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the first class team of the player born on 23 February 1973?
SELECT first_class_team FROM table_name_70 WHERE date_of_birth = "23 february 1973"
sql_create_context
CREATE TABLE table_204_164 ( id number, "branding" text, "callsign" text, "frequency" text, "power (kw)" text, "location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the difference in kw between naga and bacolod radio ?
SELECT ABS((SELECT "power (kw)" FROM table_204_164 WHERE "location" = 'naga') - (SELECT "power (kw)" FROM table_204_164 WHERE "location" = 'bacolod'))
squall
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, Manufacturer FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Name
nvbench
CREATE TABLE table_name_5 ( week INTEGER, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT IS THE AVERAGE WEEK WITH A DATE OF JULY 25?
SELECT AVG(week) FROM table_name_5 WHERE date = "july 25"
sql_create_context
CREATE TABLE table_71772 ( "Year" real, "Men's singles" text, "Women's singles" text, "Men's doubles" text, "Women's doubles" text, "Mixed doubles" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who won Women's doubles when Zen Yaqiong won Women...
SELECT "Women's doubles" FROM table_71772 WHERE "Women's singles" = 'zen yaqiong'
wikisql
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 microlab ( microl...
SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-29856' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.ho...
eicu
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
SELECT All_Home, AVG(School_ID) FROM basketball_match GROUP BY All_Home ORDER BY All_Home
nvbench
CREATE TABLE table_name_91 ( player VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who had a score of 77-69-70-71=287?
SELECT player FROM table_name_91 WHERE score = 77 - 69 - 70 - 71 = 287
sql_create_context
CREATE TABLE table_name_10 ( height_ft___m__ VARCHAR, street_address VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How tall is the Street address of 07.0 200 east washington street?
SELECT height_ft___m__ FROM table_name_10 WHERE street_address = "07.0 200 east washington street"
sql_create_context
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY...
SELECT JOB_ID, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SALARY
nvbench
CREATE TABLE teachers ( lastname text, firstname text, classroom number ) CREATE TABLE list ( lastname text, firstname text, grade number, classroom number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which teachers teach in classroom 109? Giv...
SELECT lastname FROM teachers WHERE classroom = 109
spider
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT demographic.marital_status, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "42067"
mimicsql_data
CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE month ( month_number int, ...
SELECT DISTINCT flight_id FROM flight WHERE (((departure_time > 1800 AND flight_days IN (SELECT DAYSalias0.days_code FROM days AS DAYSalias0 WHERE DAYSalias0.day_name IN (SELECT DATE_DAYalias0.day_name FROM date_day AS DATE_DAYalias0 WHERE DATE_DAYalias0.day_number = 23 AND DATE_DAYalias0.month_number = 4 AND DATE_DAYa...
atis
CREATE TABLE table_70218 ( "Currency" text, "Code" text, "Entry ERM II" text, "Central rate" text, "Official target date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the official target date for the Swedish Krona?
SELECT "Official target date" FROM table_70218 WHERE "Currency" = 'swedish krona'
wikisql
CREATE TABLE table_7194 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where was the location for Arras Paul Arras?
SELECT "Location" FROM table_7194 WHERE "Opponent" = 'arras paul arras'
wikisql
CREATE TABLE table_51373 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the record on March 22?
SELECT "Record" FROM table_51373 WHERE "Date" = 'march 22'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dod_year <= "2186.0" AND diagnoses.icd9_code = "42613"
mimicsql_data
CREATE TABLE table_name_75 ( name VARCHAR, league_cup_goals VARCHAR, league_apps VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Name has a League Cup Goals of 0, and League Apps of 1?
SELECT name FROM table_name_75 WHERE league_cup_goals = 0 AND league_apps = "1"
sql_create_context
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) 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,...
SELECT COUNT(*) > 0 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 = 10855)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [dias...
mimic_iii
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 vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-64321')) AND NOT vitalperiodic.sao2 IS NULL AND...
eicu
CREATE TABLE table_39490 ( "Volume:Issue" text, "Issue Date(s)" text, "Weeks on Top" real, "Song" text, "Artist" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was the song by Andy Gibb issued?
SELECT "Issue Date(s)" FROM table_39490 WHERE "Artist" = 'andy gibb'
wikisql
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Medicaid" AND procedures.icd9_code = "331"
mimicsql_data
CREATE TABLE table_1818471_1 ( value VARCHAR, mitchell VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is every value when Mitchell is 676?
SELECT value FROM table_1818471_1 WHERE mitchell = 676
sql_create_context
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 t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE DATETIME(lab.labresulttime) <= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 4
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND demographic.diagnosis = "COLANGITIS"
mimicsql_data
CREATE TABLE table_25794 ( "Rank" real, "City/Town" text, "County" text, "Region/Province" text, "Population" real, "Country" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When 142900 is the population what is the highest rank?
SELECT MAX("Rank") FROM table_25794 WHERE "Population" = '142900'
wikisql
CREATE TABLE table_10578 ( "Year" real, "City" text, "Rider 1" text, "Rider 2" text, "Horse 1" text, "Horse 2" text, "Association" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- With which association did estribillo ii run as Horse 1?
SELECT "Association" FROM table_10578 WHERE "Horse 1" = 'estribillo ii'
wikisql
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '7794776' AND t_kc21.IN_HOSP_DATE BETWEEN '2000-04-14' AND '2016-12-22' AND t_kc21.IN_DIAG_DIS_CD <> t_kc21.OUT_DIAG_DIS_CD
css
CREATE TABLE table_22459 ( "Township" text, "County" text, "Pop. (2010)" real, "Land ( sqmi )" text, "Water (sqmi)" text, "Latitude" text, "Longitude" text, "GEO ID" real, "ANSI code" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- ho...
SELECT COUNT("Latitude") FROM table_22459 WHERE "Water (sqmi)" = '0.081'
wikisql