instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.long_title = "Accidental fall on or from other stairs or steps"
mimicsql_data
CREATE TABLE customer ( cust_ID varchar(3), cust_name varchar(20), acc_type char(1), acc_bal int, no_of_loans int, credit_score int, branch_ID int, state varchar(20) ) CREATE TABLE bank ( branch_ID int, bname varchar(20), no_of_customers int, city varchar(10), state ...
SELECT bname, SUM(amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_ID = T2.branch_ID GROUP BY T1.bname ORDER BY SUM(amount)
nvbench
CREATE TABLE table_23268 ( "Institution" text, "Location" text, "Nickname" text, "Founded" real, "Type" text, "Enrollment" real, "Joined" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's Babson College's enrollment?
SELECT MAX("Enrollment") FROM table_23268 WHERE "Institution" = 'Babson College'
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 SUM(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.t_kc21_MED_SER_ORG_NO = '5586017' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2007-12-26' AND '2014-05-19'
css
CREATE TABLE table_19366 ( "Application" text, "Version" text, "Cmdlets" text, "Provider" text, "Management GUI" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which providers don't use exchange server?
SELECT "Provider" FROM table_19366 WHERE "Application" = 'Exchange Server'
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 departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), ...
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY COUNT(HIRE_DATE) DESC
nvbench
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
SELECT SOC_SRT_DIRE_CD, SOC_SRT_DIRE_NM FROM t_kc22 WHERE MED_CLINIC_ID = '46226661513' AND HOSP_DOC_NM LIKE '昌%'
css
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND lab.itemid = "50801"
mimicsql_data
CREATE TABLE table_36283 ( "Males Rank" real, "Females Rank" real, "State" text, "HIV awareness (males%)" real, "Females (%)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Males Rank is the highest one that has Females (%) smaller than 40, an...
SELECT MAX("Males Rank") FROM table_36283 WHERE "Females (%)" < '40' AND "Females Rank" < '22'
wikisql
CREATE TABLE table_33719 ( "Coach" text, "Years" text, "Record" text, "Conference Record" text, "Overall Win Percentage" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what years was the conference record 18-15?
SELECT "Years" FROM table_33719 WHERE "Conference Record" = '18-15'
wikisql
CREATE TABLE table_65748 ( "Sunrayia FL" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the losses when Sunrayia FL is Red Cliffs, and the against is more than 2294?
SELECT AVG("Losses") FROM table_65748 WHERE "Sunrayia FL" = 'red cliffs' AND "Against" > '2294'
wikisql
CREATE TABLE artists ( id number, name text ) CREATE TABLE sqlite_sequence ( name text, seq text ) CREATE TABLE employees ( id number, last_name text, first_name text, title text, reports_to number, birth_date time, hire_date time, address text, city text, state...
SELECT billing_state, COUNT(*), SUM(total) FROM invoices WHERE billing_state = "CA"
spider
CREATE TABLE table_32673 ( "Orchestra" text, "Conductor" text, "Record Company" text, "Year of Recording" real, "Format" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What record company has robert craft conducting?
SELECT "Record Company" FROM table_32673 WHERE "Conductor" = 'robert craft'
wikisql
CREATE TABLE table_203_639 ( id number, "year" text, "number" text, "name" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- count how many people were club president and give the total .
SELECT COUNT("name") FROM table_203_639
squall
CREATE TABLE table_10800 ( "Poll source" text, "Date(s) administered" text, "Sample size" text, "Margin of error" text, "Barbara Boxer (D)" text, "Carly Fiorina (R)" text, "Other" text, "Undecided" text ) -- Using valid SQLite, answer the following questions for the tables provided abo...
SELECT "Margin of error" FROM table_10800 WHERE "Undecided" = '8%' AND "Other" = '4%'
wikisql
CREATE TABLE county ( County_name VARCHAR, County_id VARCHAR ) CREATE TABLE election ( District VARCHAR, Committee VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the names of the county that the delegates on 'Appropriations' committee belon...
SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T2.Committee = "Appropriations"
sql_create_context
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 JCZBMC, JCZBJGDW, AVG(JCZBJGDL) FROM jyjgzbb WHERE YLJGDM = '2203428' AND BGRQ BETWEEN '2002-06-28' AND '2011-08-03' GROUP BY JCZBMC, JCZBJGDW ORDER BY AVG(JCZBJGDL) LIMIT 20
css
CREATE TABLE table_11512 ( "State" text, "Swimsuit" real, "Evening gown" real, "Interview" real, "Average" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the least evening gown for interview more than 7.97 and swimsui of 7.24
SELECT MIN("Evening gown") FROM table_11512 WHERE "Swimsuit" = '7.24' AND "Interview" > '7.97'
wikisql
CREATE TABLE table_65897 ( "Airing date" text, "English title (Chinese title)" text, "Number of episodes" real, "Genre" text, "Official website" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest number of episodes in a series with an...
SELECT MIN("Number of episodes") FROM table_65897 WHERE "Airing date" = '12 jan- 6 feb'
wikisql
CREATE TABLE table_43851 ( "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On which Surface will Estrella Cabeza Candela play?
SELECT "Surface" FROM table_43851 WHERE "Opponent" = 'estrella cabeza candela'
wikisql
CREATE TABLE table_1346137_4 ( candidates VARCHAR, district VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who were the candidates in the district of South Carolina 5?
SELECT candidates FROM table_1346137_4 WHERE district = "South Carolina 5"
sql_create_context
CREATE TABLE hz_info_mzjzjlb ( JZLSH number, YLJGDM number, mzjzjlb_id number ) CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW t...
SELECT jyjgzbb.YQBH, jyjgzbb.YQMC FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgz...
css
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "7" AND diagnoses.short_title = "Single lb in-hosp w cs"
mimicsql_data
CREATE TABLE table_45190 ( "Date" text, "Score" text, "Set 1" text, "Set 2" text, "Set 3" text, "Total" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date was the set 1 25 23, and a Set 3 of 25 14?
SELECT "Date" FROM table_45190 WHERE "Set 1" = '25–23' AND "Set 3" = '25–14'
wikisql
CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDispl...
SELECT q.Id AS "post_link", COUNT(pf.FlagTypeId) AS CVs, q.ViewCount FROM Posts AS q INNER JOIN Users AS u ON u.Id = q.OwnerUserId INNER JOIN PostHistory AS ph ON ph.Id = q.Id INNER JOIN PendingFlags AS pf ON pf.PostId = q.Id WHERE q.PostTypeId = 1 AND DATEDIFF(DAY, q.CreationDate, GETDATE()) > 365 AND q.Score = 0 AND ...
sede
CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, ...
SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_co...
advising
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, ...
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26995) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY procedures_icd.charttime DESC LIMIT ...
mimic_iii
CREATE TABLE table_70932 ( "Team" text, "Manager 1" text, "Captain" text, "Kit manufacturer" text, "Shirt sponsor" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the shirt sponsor for the Blackburn Rovers?
SELECT "Shirt sponsor" FROM table_70932 WHERE "Team" = 'blackburn rovers'
wikisql
CREATE TABLE table_name_17 ( position VARCHAR, school VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the position for indiana state
SELECT position FROM table_name_17 WHERE school = "indiana state"
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 WHERE demographic.diagnosis = "ABDOMINAL PAIN" AND demographic.age < "72"
mimicsql_data
CREATE TABLE table_name_67 ( örebro VARCHAR, umeå VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What did Orebro score when Umea scored 2?
SELECT örebro FROM table_name_67 WHERE umeå = "2"
sql_create_context
CREATE TABLE table_62607 ( "Year" real, "Network" text, "Play-by-play" text, "Colour commentator(s)" text, "Pregame host" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For which network was Chris Walby the color commentator after 1990?
SELECT "Network" FROM table_62607 WHERE "Year" > '1990' AND "Colour commentator(s)" = 'chris walby'
wikisql
CREATE TABLE table_name_40 ( position VARCHAR, event VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Position, when Event is 60 m, and when Venue is Budapest , Hungary?
SELECT position FROM table_name_40 WHERE event = "60 m" AND venue = "budapest , hungary"
sql_create_context
CREATE TABLE mzjzjlb_jybgb ( YLJGDM_MZJZJLB text, BGDH number, YLJGDM number ) CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, ...
SELECT mzjzjlb.JZLSH FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE hz_info.RYBH = '55748768' AND hz_info.YLJGDM = '3373155' AND mzjzjlb.JZKSMC LIKE '%推拿%'
css
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, ...
SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28775 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)) AND chartevent...
mimic_iii
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemics...
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 = 'endotracheal tube removal' AND DATETIME(treatment.treatmenttime, 'start o...
eicu
CREATE TABLE table_11622255_1 ( date VARCHAR, location VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what's the date where location is illinois
SELECT date FROM table_11622255_1 WHERE location = "Illinois"
sql_create_context
CREATE TABLE table_3935 ( "Round" real, "Race" text, "Pole position" text, "Fastest lap" text, "Most laps led" text, "Driver" text, "Team" text, "Manufacturer" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the...
SELECT "Driver" FROM table_3935 WHERE "Round" = '8'
wikisql
CREATE TABLE table_18813011_6 ( high_assists VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who had the high assist in the game where the record is 13-11?
SELECT high_assists FROM table_18813011_6 WHERE record = "13-11"
sql_create_context
CREATE TABLE table_222771_1 ( alpha_3_code VARCHAR, alpha_2_code VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Alpha 3 code for the area also known as FO?
SELECT alpha_3_code FROM table_222771_1 WHERE alpha_2_code = "FO"
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 * FROM gwyjzb WHERE gwyjzb.PERSON_NM = '袁清怡' AND gwyjzb.MED_SER_ORG_NO = '0621277' AND gwyjzb.MED_ORG_DEPT_NM LIKE '%整形%' UNION SELECT * FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '袁清怡' AND fgwyjzb.MED_SER_ORG_NO = '0621277' AND fgwyjzb.MED_ORG_DEPT_NM LIKE '%整形%'
css
CREATE TABLE documents ( document_code text, document_structure_code text, document_type_code text, access_count number, document_name text ) CREATE TABLE images ( image_id number, image_alt_text text, image_name text, image_url text ) CREATE TABLE document_functional_areas ( d...
SELECT t2.section_title FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code WHERE t1.document_name = "David CV"
spider
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 * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZ...
css
CREATE TABLE table_14986292_1 ( population_density_2010___km²_ VARCHAR, administrative_division VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the number of population density 2010 for duque de caxias
SELECT COUNT(population_density_2010___km²_) FROM table_14986292_1 WHERE administrative_division = "Duque de Caxias"
sql_create_context
CREATE TABLE table_46024 ( "Pick #" real, "CFL Team" text, "Player" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Player, when Position is DB, and when College is Saint Mary's?
SELECT "Player" FROM table_46024 WHERE "Position" = 'db' AND "College" = 'saint mary''s'
wikisql
CREATE TABLE table_204_51 ( id number, "week #" text, "theme" text, "song choice" text, "original artist" text, "order #" number, "result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- is the order # of top 6 greater than that of top 8 ?
SELECT (SELECT "order #" FROM table_204_51 WHERE "week #" = 'top 6') > (SELECT "order #" FROM table_204_51 WHERE "week #" = 'top 8')
squall
CREATE TABLE table_47873 ( "Season" text, "Coach" text, "Captain" text, "Alternate (1)" text, "Alternate (2)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which coach works with Robert Harvey?
SELECT "Coach" FROM table_47873 WHERE "Captain" = 'robert harvey'
wikisql
CREATE TABLE table_63694 ( "School" text, "City" text, "Team Name" text, "County" text, "Year Joined" text, "Year Left" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year did the team based in the city of Winamac join the conference?
SELECT "Year Joined" FROM table_63694 WHERE "City" = 'winamac'
wikisql
CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBase...
WITH YourQuestions AS (SELECT Id FROM Posts WHERE OwnerUserId = '##UserId##' AND PostTypeId = 1), AnswersToYourQuestions AS (SELECT * FROM Posts WHERE ParentId IN (SELECT Id FROM YourQuestions)) SELECT PostId AS "post_link", CreationDate, Id AS "comment_link" FROM Comments WHERE UserId = '##CommenterUserId##' AND PostI...
sede
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, Deletio...
SELECT p.Id AS Id, TIME_TO_STR(p.CreationDate, '%-HOUR') AS Hour, LENGTH(p.Title) AS LengthOfTitle, LENGTH(p.Body) AS LengthOfBody, p.Score AS Score, p.ViewCount AS Views, p.AnswerCount AS Answers FROM Posts AS p WHERE LENGTH(p.Title) > 0 AND p.CreationDate > CAST('2014-10-01 00:00:00.000' AS DATETIME) AND p.CreationDa...
sede
CREATE TABLE table_name_30 ( player VARCHAR, school_club_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Player from McGill?
SELECT player FROM table_name_30 WHERE school_club_team = "mcgill"
sql_create_context
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE PostHistoryTypes ( Id numb...
SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY Id) AS row FROM Users) AS a WHERE a.row > 5 AND a.row <= 100
sede
CREATE TABLE table_name_45 ( game INTEGER, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest Game, when Date is 'November 1'?
SELECT MIN(game) FROM table_name_45 WHERE date = "november 1"
sql_create_context
CREATE TABLE table_name_47 ( week VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What game week did the Buccaneers play against the Minnesota Vikings?
SELECT week FROM table_name_47 WHERE opponent = "minnesota vikings"
sql_create_context
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients ( row_id number, subject_id number, g...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE NOT admissions.dischtime IS NULL AND STRFTIME('%y', admissions.dischtime) <= '2102'
mimic_iii
CREATE TABLE job_history ( employee_id number, start_date time, end_date time, job_id text, department_id number ) CREATE TABLE regions ( region_id number, region_name text ) CREATE TABLE locations ( location_id number, street_address text, postal_code text, city text, ...
SELECT job_id FROM employees GROUP BY job_id HAVING AVG(salary) > 8000
spider
CREATE TABLE table_38964 ( "Week 2 Sept 7" text, "Week 3 Sept 14" text, "Week 4 Sept 21" text, "Week 5 Sept 28" text, "Week 6 Oct 5" text, "Week 7 Oct 12" text, "Week 10 Nov 2" text, "Week 12 Nov 16" text, "Week 14 Nov 30" text, "Week 15 Dec 7" text, "Week 16 (Final) Jan 9" t...
SELECT "Week 4 Sept 21" FROM table_38964 WHERE "Week 10 Nov 2" = 'michigan state (8-2)'
wikisql
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 COUNT(*) FROM (SELECT jybgb.KSBM FROM mzjzjlb JOIN jybgb JOIN mzjzjlb_jybgb ON mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND mzjzjlb_jybgb.YLJGDM = jybgb.YLJGDM AND mzjzjlb_jybgb.BGDH = jybgb.BGDH AND mzjzjlb_jybgb.YLJGDM = jybgb.YLJGDM AND mzjzjlb_jybgb.BGDH = jybgb.B...
css
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
SELECT MED_DIRE_CD, MED_DIRE_NM FROM t_kc22 WHERE MED_CLINIC_ID = '81908180508' AND SOC_SRT_DIRE_NM = '开塞露(含甘油)'
css
CREATE TABLE table_203_356 ( id number, "type" text, "diagonal (mm)" text, "width (mm)" text, "height (mm)" text, "area (mm2)" text, "stops (area)" number, "crop factor" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many sensors hav...
SELECT COUNT("type") FROM table_203_356 WHERE "crop factor" < 1.0
squall
CREATE TABLE table_65849 ( "Date Released" text, "Institute" text, "Social Democratic" text, "Socialist" text, "Green-Communist" text, "Democratic Renewal" text, "Democratic and Social Centre" text, "Lead" text ) -- Using valid SQLite, answer the following questions for the tables prov...
SELECT "Social Democratic" FROM table_65849 WHERE "Democratic and Social Centre" = '4.4% 4 seats'
wikisql
CREATE TABLE table_36676 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Gold has a Bronze larger than 6?
SELECT MIN("Gold") FROM table_36676 WHERE "Bronze" > '6'
wikisql
CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE TABLE CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), CLASS_ROOM varchar(8), PROF_NUM int ) CREATE...
SELECT SCHOOL_CODE, COUNT(*) FROM DEPARTMENT AS T1 JOIN PROFESSOR AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.SCHOOL_CODE ORDER BY SCHOOL_CODE
nvbench
CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PostHistoryTypes ( Id number, ...
SELECT YEAR(CreationDate) AS "year", MONTH(CreationDate) AS "month", SUM(CASE WHEN Posts.PostTypeId = 1 THEN 1 ELSE 0 END) AS QuestionCount, SUM(CASE WHEN Posts.PostTypeId = 2 THEN 1 ELSE 0 END) AS AnswerCount FROM Posts WHERE YEAR(CreationDate) >= 2014 GROUP BY YEAR(CreationDate), MONTH(CreationDate) ORDER BY YEAR(Cre...
sede
CREATE TABLE Invoice_Line_Items ( order_item_id INTEGER, invoice_number INTEGER, product_id INTEGER, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19,4), derived_product_cost DECIMAL(19,4), derived_vat_payable DECIMAL(19,4), derived_total_cost DECIMAL...
SELECT customer_last_name, COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_9433 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Lions' Points" text, "Opponents' Points" text, "Record" text, "Streak" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the...
SELECT COUNT("Week") FROM table_9433 WHERE "Record" = '0-11'
wikisql
CREATE TABLE table_41139 ( "S No" real, "Team (A)" text, "Team (B)" text, "Winner" text, "Margin" text, "Match Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Team (B), when S No is less than 18, when Margin is 8 Wickets, and when M...
SELECT "Team (B)" FROM table_41139 WHERE "S No" < '18' AND "Margin" = '8 wickets' AND "Match Date" = 'oct 30, 1989'
wikisql
CREATE TABLE table_40239 ( "Player" text, "Position" text, "GP (GS)" text, "Minutes" real, "Goals" real, "Assists" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of minutes when there are more than 4 goals and 3 assists?
SELECT "Minutes" FROM table_40239 WHERE "Goals" > '4' AND "Assists" = '3'
wikisql
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number,...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', lab.labresulttime)) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-66291' AND patient.hospi...
eicu
CREATE TABLE table_name_28 ( i_o_bus VARCHAR, sspec_number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the i/o bus when the sspec numebr is sr0n5(l1)?
SELECT i_o_bus FROM table_name_28 WHERE sspec_number = "sr0n5(l1)"
sql_create_context
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE d_labitems ( row_id number...
SELECT COUNT(*) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 64185) AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-6 year')
mimic_iii
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE PostLinks ( Id number, CreationDate time, Pos...
SELECT AVG(Reputation) AS "average_reputation", COUNT(Id) AS "total_users" FROM Users WHERE LOWER(Location) LIKE '%united kingdom' AND Reputation >= 15
sede
CREATE TABLE table_37473 ( "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 largest drawn that has a played les...
SELECT MAX("Drawn") FROM table_37473 WHERE "Played" < '38'
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 demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2124" AND lab."CATEGORY" = "Hematology"
mimicsql_data
CREATE TABLE table_35741 ( "Name" text, "Location" text, "State" text, "Opened (closing date if defunct)" text, "Surface" text, "Length" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Location for the woodburn dragstrip?
SELECT "Location" FROM table_35741 WHERE "Name" = 'woodburn dragstrip'
wikisql
CREATE TABLE table_31009 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many episodes ...
SELECT COUNT("No. in season") FROM table_31009 WHERE "Title" = 'First Blood'
wikisql
CREATE TABLE table_79113 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What place had a To par of 10?
SELECT "Place" FROM table_79113 WHERE "To par" = '–10'
wikisql
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ...
SELECT admissions.dischtime FROM admissions WHERE admissions.subject_id = 75658 AND DATETIME(admissions.dischtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY admissions.dischtime LIMIT 1
mimic_iii
CREATE TABLE table_name_49 ( home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is fitzroy's score as the home team?
SELECT home_team AS score FROM table_name_49 WHERE home_team = "fitzroy"
sql_create_context
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 employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), ...
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID) DESC
nvbench
CREATE TABLE Certificate ( eid VARCHAR, aid VARCHAR ) CREATE TABLE Employee ( name VARCHAR, eid VARCHAR ) CREATE TABLE Aircraft ( aid VARCHAR, distance INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the salary and name of the employ...
SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.distance > 5000 GROUP BY T1.eid ORDER BY COUNT(*) DESC LIMIT 1
sql_create_context
CREATE TABLE table_26861 ( "Season" real, "Series" text, "Team" text, "Races" real, "Wins" real, "Poles" real, "FLaps" real, "Podiums" real, "Points" text, "Position" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the total ...
SELECT COUNT("Races") FROM table_26861 WHERE "Position" = '15th'
wikisql
CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABL...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE (LOWER(Location) LIKE '%ahmedabad%' OR UPPER(Location) LIKE '%AHMEDABAD%' OR Location LIKE '%Ahmedabad%') AND Reputation >= 500 ORDER BY Reputation DESC
sede
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 mzjzjlb_jybgb ( YLJGDM_MZJZJLB te...
SELECT COUNT(*) FROM mzjzjlb WHERE mzjzjlb.YLJGDM = '7702859' AND mzjzjlb.JZKSRQ BETWEEN '2011-06-06' AND '2021-10-25' AND mzjzjlb.ZSEBZ > 0
css
CREATE TABLE table_9422 ( "Team" text, "All Games" text, "All Games %" real, "Nonconference Games" text, "Nonconference Games %" real, "Ranked AP Nonconference" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which All Games have a Nonconference ...
SELECT "All Games" FROM table_9422 WHERE "Nonconference Games %" < '0.75' AND "Ranked AP Nonconference" = '3–7'
wikisql
CREATE TABLE staff ( staff_id VARCHAR, staff_name VARCHAR ) CREATE TABLE Staff_Department_Assignments ( staff_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find the id and name of the staff who has been assigned for the shortest period.
SELECT T1.staff_id, T1.staff_name FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY date_assigned_to - date_assigned_from LIMIT 1
sql_create_context
CREATE TABLE table_68184 ( "Season" real, "Overall" text, "Slalom" text, "Giant Slalom" text, "Super G" text, "Downhill" text, "Combined" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which downhill has 7 overalls?
SELECT "Downhill" FROM table_68184 WHERE "Overall" = '7'
wikisql
CREATE TABLE table_39043 ( "Position" real, "Team" text, "Played" real, "Wins" real, "Draws" real, "Losses" real, "Scored" real, "Conceded" real, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the lowest Position with...
SELECT MIN("Position") FROM table_39043 WHERE "Conceded" > '16' AND "Draws" = '3' AND "Losses" > '3'
wikisql
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 (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'chest pain - unlikely cardiac in origin' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DA...
eicu
CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adults INTEGER, Kids INTEGER ) CREATE TABLE Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy INTEGER, baseP...
SELECT bedType, COUNT(bedType) FROM Rooms WHERE decor = "traditional" GROUP BY bedType
nvbench
CREATE TABLE table_52981 ( "Game" real, "Date" text, "Batting 1st" text, "Batting 2nd" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who is batting 1st in game 8?
SELECT "Batting 1st" FROM table_52981 WHERE "Game" = '8'
wikisql
CREATE TABLE table_21062 ( "Name" text, "Latitude" text, "Longitude" text, "Diameter" text, "Year named" real, "Namesake" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many longitudes have a latitude of 9.9n?
SELECT COUNT("Longitude") FROM table_21062 WHERE "Latitude" = '9.9N'
wikisql
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 Team_ID, School_ID FROM basketball_match GROUP BY ACC_Road
nvbench
CREATE TABLE table_203_491 ( id number, "year" number, "title" text, "us hot 100" number, "us modern rock" number, "us mainstream rock" number, "album" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- calculate the number of songs listed betwe...
SELECT COUNT("title") FROM table_203_491 WHERE "year" >= 1994 AND "year" <= 2005
squall
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 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnosis.diagnosistime)) FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-9636'...
eicu
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuo...
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12775) AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', prescriptions.startdate) = '12' ORD...
mimic_iii
CREATE TABLE table_25392 ( "Team" text, "SEC Wins" real, "SEC Losses" real, "Percentage" text, "Home Record" text, "Road Record" text, "Overall Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the percentage for georgia
SELECT "Percentage" FROM table_25392 WHERE "Team" = 'Georgia'
wikisql
CREATE TABLE table_35349 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the score from the 21-27 Record?
SELECT "Score" FROM table_35349 WHERE "Record" = '21-27'
wikisql
CREATE TABLE table_21550870_1 ( original_air_date VARCHAR, us_viewers__million_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the original air date for 9.16 viewers
SELECT original_air_date FROM table_21550870_1 WHERE us_viewers__million_ = "9.16"
sql_create_context
CREATE TABLE game ( stadium_id int, id int, Season int, Date text, Home_team text, Away_team text, Score text, Competition text ) CREATE TABLE injury_accident ( game_id int, id int, Player text, Injury text, Number_of_matches text, Source text ) CREATE TABLE sta...
SELECT Season, COUNT(Season) FROM game GROUP BY Home_team, Season ORDER BY Season DESC
nvbench