instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_name_50 ( runs_allowed INTEGER, rank VARCHAR, losses VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many runs allowed did the team ranked 2 with more than 2 losses have?
SELECT AVG(runs_allowed) FROM table_name_50 WHERE rank = 2 AND losses > 2
sql_create_context
CREATE TABLE table_12792876_4 ( losing_bonus VARCHAR, tries_for VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the losing bonus for 27
SELECT losing_bonus FROM table_12792876_4 WHERE tries_for = "27"
sql_create_context
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND date_day.day_number = 27 AND date_day.month_number = 8 AND d...
atis
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
SELECT MAX(demographic.age) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.discharge_location = "SNF"
mimicsql_data
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 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '017-16041' AND patient.wardid = 657 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1
eicu
CREATE TABLE table_name_48 ( score VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What score is the team of charlotte?
SELECT score FROM table_name_48 WHERE team = "charlotte"
sql_create_context
CREATE TABLE table_name_93 ( winnings VARCHAR, top_10 VARCHAR, starts VARCHAR, poles VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Winnings have Starts larger than 34, and Poles smaller than 1, and a Top 10 of 5?
SELECT winnings FROM table_name_93 WHERE starts > 34 AND poles < 1 AND top_10 = 5
sql_create_context
CREATE TABLE table_35791 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Game Site" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest week number that there was a game on October...
SELECT MIN("Week") FROM table_35791 WHERE "Attendance" < '68,977' AND "Date" = 'october 23, 1977'
wikisql
CREATE TABLE domain_publication ( did int, pid int ) CREATE TABLE conference ( cid int, homepage varchar, name varchar ) CREATE TABLE domain_journal ( did int, jid int ) CREATE TABLE domain ( did int, name varchar ) CREATE TABLE keyword ( keyword varchar, kid int ) CREAT...
SELECT COUNT(DISTINCT (author.name)) FROM author, journal, publication, writes WHERE journal.name = 'PVLDB' AND publication.jid = journal.jid AND writes.aid = author.aid AND writes.pid = publication.pid
academic
CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_ca...
SELECT COUNT(*), SUM(student_capacity) FROM Dorm GROUP BY gender
nvbench
CREATE TABLE table_name_50 ( opponents VARCHAR, kick_off VARCHAR, h___a VARCHAR, referee VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the opponent of the match with a H/A of h, Beguiristain Iceta as the referee, and a kick off at 1993-04-18 ...
SELECT opponents FROM table_name_50 WHERE h___a = "h" AND referee = "beguiristain iceta" AND kick_off = "1993-04-18 17:00"
sql_create_context
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 admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time,...
SELECT (SELECT COUNT(DISTINCT t1.subject_id) 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_diagnoses.short_title = 'choledochl...
mimic_iii
CREATE TABLE table_53816 ( "Player" text, "Position" text, "Date of Birth (Age)" text, "Caps" real, "Club/province" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average number of caps for Meralomas with positions of centre?
SELECT AVG("Caps") FROM table_53816 WHERE "Club/province" = 'meralomas' AND "Position" = 'centre'
wikisql
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId...
SELECT t.TagName FROM Tags AS t /* *, COUNT(*) AS Count FROM ( SELECT CAST( CAST(DATEPART(YYYY, CreationDate) AS varchar) + '-' + CAST(DATEPART(MM, CreationDate) AS varchar) + '-01' AS DATETIME) 'month', t.TagName FROM Posts p JOIN PostTags pt ON pt.PostId = p.Id JOIN Tags t ON t.Id = pt.TagId WHERE TagId IN ( SELECT T...
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 hz_info_mzjzjlb ( JZLSH number, ...
SELECT jybgb.BGDH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb 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_MZJZJLB ...
css
CREATE TABLE table_name_29 ( visitor VARCHAR, home VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the visitor team of the game where Buffalo was the home team?
SELECT visitor FROM table_name_29 WHERE home = "buffalo"
sql_create_context
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE medication ( medi...
SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-40970')) AND lab.labname = 'mpv' AND STRFTIME('%y', lab.labresulttime) = '2103'
eicu
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 demographic.insurance, demographic.diagnosis FROM demographic WHERE demographic.subject_id = "8990"
mimicsql_data
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 gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_NM = '谢雅云' AND gwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT >= 1942.72) UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '谢雅云' AND fgwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc2...
css
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CRE...
SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-24513')) AND intakeoutput.celllabel = 'indwe...
eicu
CREATE TABLE table_55721 ( "Race Name" text, "Circuit" text, "Date" text, "Winning driver" text, "Constructor" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What does the Circuit of caen report?
SELECT "Report" FROM table_55721 WHERE "Circuit" = 'caen'
wikisql
CREATE TABLE table_name_52 ( name VARCHAR, winning_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Penske Racing's name?
SELECT name FROM table_name_52 WHERE winning_team = "penske racing"
sql_create_context
CREATE TABLE table_2150068_1 ( nation VARCHAR, satellite VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What nation was Pageos 1 from?
SELECT nation FROM table_2150068_1 WHERE satellite = "PAGEOS 1"
sql_create_context
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE Badges ( Id number, UserId numb...
WITH tmp AS (SELECT p.Id, p.AcceptedAnswerId AS Acc, Period = TIME_TO_STR(bs.CreationDate, '%W') FROM Posts AS p INNER JOIN Votes AS bs ON p.Id = bs.PostId AND bs.VoteTypeId = 8) SELECT Period, ROUND((COUNT(Acc)) * 100.0 / (COUNT(*)), 2) AS percentage FROM tmp GROUP BY Period ORDER BY Period
sede
CREATE TABLE table_name_79 ( capacity INTEGER, location VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the lowest capacity in grodno
SELECT MIN(capacity) FROM table_name_79 WHERE location = "grodno"
sql_create_context
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'sodium, whole blood')) AND STRFTIME('%y', cost.chargetime) <= '2104' GROUP BY cost.hadm_id) AS t1
mimic_iii
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND procedures.icd9_code = "331"
mimicsql_data
CREATE TABLE musical ( musical_id number, name text, year number, award text, category text, nominee text, result text ) CREATE TABLE actor ( actor_id number, name text, musical_id number, character text, duration text, age number ) -- Using valid SQLite, answer th...
SELECT nominee, COUNT(*) FROM musical GROUP BY nominee
spider
CREATE TABLE table_name_68 ( length VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Length, when the Name is Himos?
SELECT length FROM table_name_68 WHERE name = "himos"
sql_create_context
CREATE TABLE table_66128 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "TV Time" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the tv time for the game on week 12?
SELECT "TV Time" FROM table_66128 WHERE "Week" = '12'
wikisql
CREATE TABLE table_name_98 ( rank INTEGER, react VARCHAR, time VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Rank has a Reaction of 0.198, and a Time smaller than 46.3?
SELECT MAX(rank) FROM table_name_98 WHERE react = 0.198 AND time < 46.3
sql_create_context
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 person_info.XM FROM person_info JOIN hz_info JOIN zyjzjlb JOIN jybgb JOIN person_info_hz_info ON person_info.RYBH = person_info_hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND zyjzjlb.YLJGDM = jybgb.YLJGDM_ZYJZJLB AND zyjzjlb.JZLSH = jybgb.JZLSH_ZYJZ...
css
CREATE TABLE table_1639689_2 ( date VARCHAR, week VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What day(s) did they play on week 2?
SELECT date FROM table_1639689_2 WHERE week = 2
sql_create_context
CREATE TABLE table_5062 ( "Race" text, "Length" text, "Class" text, "Circuit" text, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the length for all class and date of march 18
SELECT "Length" FROM table_5062 WHERE "Class" = 'all' AND "Date" = 'march 18'
wikisql
CREATE TABLE table_3860 ( "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 "Location Attendance" FROM table_3860 WHERE "Record" = '39–7'
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Continuous invasive mechanical ventilation for less than 96 consecutive hours" AND lab."CATEGORY" = "Chemist...
mimicsql_data
CREATE TABLE d_icd_procedures ( 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 time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, ...
SELECT chartevents.charttime 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 = 1272)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart rat...
mimic_iii
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE icustays ( row_id number, s...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures ...
mimic_iii
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 t_kc21 WHERE t_kc21.PERSON_NM = '沈清妍' AND t_kc21.MED_SER_ORG_NO = '6343102' AND t_kc21.MED_ORG_DEPT_NM LIKE '%产前诊断%'
css
CREATE TABLE table_41128 ( "Rank" real, "Location" text, "Total Passengers" real, "Annual change" text, "Capacity" real, "Capacity in use" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average capacity for less than 8,261,355 passen...
SELECT AVG("Capacity") FROM table_41128 WHERE "Total Passengers" < '8,261,355' AND "Capacity in use" = '126,06%'
wikisql
CREATE TABLE table_name_54 ( result VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result of the game with 67,715 fans attending?
SELECT result FROM table_name_54 WHERE attendance = "67,715"
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" AND procedures.short_title = "Other skin & subq i & d"
mimicsql_data
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY ...
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 JOB_ID DESC
nvbench
CREATE TABLE table_name_87 ( school VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the school for eagles
SELECT school FROM table_name_87 WHERE team = "eagles"
sql_create_context
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE patient ( uniquep...
SELECT microlab.culturesite FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-19622')) AND DATETIME(microlab.culturetakentime) <= DATETIME(CURRE...
eicu
CREATE TABLE table_name_68 ( home VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What home is dated march 19?
SELECT home FROM table_name_68 WHERE date = "march 19"
sql_create_context
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_Neutral, School_ID FROM basketball_match ORDER BY All_Neutral
nvbench
CREATE TABLE table_name_23 ( pick__number VARCHAR, college VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the pick# from South Dakota college?
SELECT pick__number FROM table_name_23 WHERE college = "south dakota"
sql_create_context
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, v...
SELECT DISTINCT prescriptions.route FROM prescriptions WHERE prescriptions.drug = 'amitriptyline hcl'
mimic_iii
CREATE TABLE table_47495 ( "Rank" real, "Club" text, "Points" real, "Played" real, "Victories" real, "Draws" real, "Defeats" real, "Goals for" real, "Goals against" real, "Goal average" real ) -- Using valid SQLite, answer the following questions for the tables provided above. ...
SELECT AVG("Goals for") FROM table_47495 WHERE "Rank" = '3'
wikisql
CREATE TABLE table_name_92 ( entrant VARCHAR, year VARCHAR, chassis VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the entrant for year more than 1991 and chassis of lotus 109
SELECT entrant FROM table_name_92 WHERE year > 1991 AND chassis = "lotus 109"
sql_create_context
CREATE TABLE table_name_33 ( cuts_made INTEGER, events VARCHAR, top_5 VARCHAR, top_10 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of cuts made when the top-5 is 0, top-10 is 1 and events are fewer than 12?
SELECT AVG(cuts_made) FROM table_name_33 WHERE top_5 = 0 AND top_10 = 1 AND events < 12
sql_create_context
CREATE TABLE table_21754 ( "Gatchaman" text, "Battle of the Planets" text, "G-Force" text, "Eagle Riders" text, "OVA (Harmony Gold Dub)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which eagle riders have battle of the planets as zoltar?
SELECT "Eagle Riders" FROM table_21754 WHERE "Battle of the Planets" = 'Zoltar'
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 (SELECT SUM(t_kc22.STA_FLG) FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '01708442778') = (SELECT COUNT(*) FROM t_kc22 WHERE t_kc21_t_kc22.MED_CLINIC_ID = '01708442778')
css
CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE swimme...
SELECT meter_200, AVG(ID) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 DESC
nvbench
CREATE TABLE table_name_99 ( district VARCHAR, first_elected VARCHAR, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what district was incumbent Russ Carnahan elected after 2000?
SELECT district FROM table_name_99 WHERE first_elected > 2000 AND incumbent = "russ carnahan"
sql_create_context
CREATE TABLE table_60146 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" text, "Finish" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest total to par of +9?
SELECT MAX("Total") FROM table_60146 WHERE "To par" = '+9'
wikisql
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE labevents ( row_id number, subje...
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'excise lg intestine les') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 83466) AND DATETIME(pro...
mimic_iii
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Retention urine NOS" AND lab.fluid = "Other Body Fluid"
mimicsql_data
CREATE TABLE table_17877 ( "No" real, "Player" text, "Height" text, "Position" text, "Year born" real, "Current Club" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what's current club with height being 2.09
SELECT "Current Club" FROM table_17877 WHERE "Height" = '2.09'
wikisql
CREATE TABLE table_204_362 ( id number, "episode" number, "airdate" text, "game 1" text, "game 2" text, "game 3" text, "viewers" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- on what date did the first episode of the whole 19 yards air ?
SELECT "airdate" FROM table_204_362 WHERE "episode" = 1
squall
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.discharge_location = "SNF" AND diagnoses.long_title = "Cerebral artery occlusion, unspecified with cerebral infarction"
mimicsql_data
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Users.Id AS "user_link", Reputation, Location FROM Users, Badges WHERE Users.Id = Badges.UserId AND Badges.Class = 1 AND Badges.TagBased = 1 AND Badges.Name = 'node.js' AND LOWER(Users.Location) LIKE LOWER('%Poland%') ORDER BY Reputation DESC
sede
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, ...
SELECT COUNT(*) > 0 FROM course WHERE department = 'EECS' AND has_lab = 'Y' AND number = 495
advising
CREATE TABLE table_name_62 ( snatch VARCHAR, bodyweight VARCHAR, total__kg_ VARCHAR, clean_ VARCHAR, _jerk VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the total number of snatches for clean and jerk more than 132.5 when the total kg wa...
SELECT COUNT(snatch) FROM table_name_62 WHERE clean_ & _jerk > 132.5 AND total__kg_ = 315 AND bodyweight = 68.63
sql_create_context
CREATE TABLE table_75026 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Score of postponed (rain) rescheduled for June 27 had what loss?
SELECT "Loss" FROM table_75026 WHERE "Score" = 'postponed (rain) rescheduled for june 27'
wikisql
CREATE TABLE table_68662 ( "Name" text, "Years" text, "Gender" text, "Area" text, "Authority" text, "Decile" real, "Roll" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total amount of decile with the authority of state around th...
SELECT SUM("Decile") FROM table_68662 WHERE "Authority" = 'state' AND "Name" = 'pokuru school' AND "Roll" < '109'
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.drug_type = "MAIN" AND lab.label = "Glucose, Body Fluid"
mimicsql_data
CREATE TABLE table_name_31 ( lost INTEGER, goals_for VARCHAR, position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many lost when goals for is 43 and the position number is higher than 15?
SELECT AVG(lost) FROM table_name_31 WHERE goals_for = 43 AND position > 15
sql_create_context
CREATE TABLE table_62135 ( "Round" real, "Race" text, "Circuit" text, "Date" text, "Event" text, "Winning driver" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Date, when Round is '2'?
SELECT "Date" FROM table_62135 WHERE "Round" = '2'
wikisql
CREATE TABLE table_25419 ( "Year" real, "Majors" real, "ATP wins" real, "Total wins" real, "Earnings ($)" real, "Money list rank" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was his money list rank in 2001?
SELECT MIN("Money list rank") FROM table_25419 WHERE "Year" = '2001'
wikisql
CREATE TABLE editor ( Editor_ID int, Name text, Age real ) CREATE TABLE journal_committee ( Editor_ID int, Journal_ID int, Work_Type text ) CREATE TABLE journal ( Journal_ID int, Date text, Theme text, Sales int ) -- Using valid SQLite, answer the following questions for the ...
SELECT Name, Age FROM editor ORDER BY Age
nvbench
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.icd9_code = "4632"
mimicsql_data
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 MAX(demographic.age) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.diagnosis = "PITUITARY BLEED"
mimicsql_data
CREATE TABLE table_40389 ( "School year" text, "95-96" text, "99-00" text, "00-01" text, "01-02" text, "02-03" text, "03-04" text, "04-05" text, "05-06" text, "06-07" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is 03-04, ...
SELECT "03-04" FROM table_40389 WHERE "00-01" = '67.4'
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 COUNT(*) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_ID = '92983235' AND t_kc22.STA_DATE BETWEEN '2002-05-23' AND '2004-11-06' AND gwyjzb.MED_SER_ORG_NO = '8089445' AND t_kc22.MED_INV_ITEM_TYPE = '西药费' UNION SELECT COUNT(*) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CL...
css
CREATE TABLE table_72004 ( "Place" real, "Team" text, "Played" real, "Draw" real, "Lost" real, "Goals Scored" real, "Goals Conceded" real, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the total of Lost that's got Points...
SELECT SUM("Lost") FROM table_72004 WHERE "Points" > '28' AND "Draw" = '5' AND "Place" < '1'
wikisql
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "ASIAN" AND prescriptions.drug_type = "MAIN"
mimicsql_data
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT t_kc22.CHA_ITEM_LEV FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '21654951131' AND t_kc22.SOC_SRT_DIRE_CD = '350675'
css
CREATE TABLE table_name_97 ( attendance INTEGER, week VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average attendance at a week 4 game?
SELECT AVG(attendance) FROM table_name_97 WHERE week = 4
sql_create_context
CREATE TABLE table_15013 ( "Rank" real, "Player" text, "From" text, "Transfer fee ( \u20ac million)" real, "Year" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the highest transfer fee in 2008 that is from psv and is ranked larger than 17?...
SELECT MAX("Transfer fee ( \u20ac million)") FROM table_15013 WHERE "Year" = '2008' AND "From" = 'psv' AND "Rank" > '17'
wikisql
CREATE TABLE employee ( eid number, name text, salary number ) CREATE TABLE flight ( flno number, origin text, destination text, distance number, departure_date time, arrival_date time, price number, aid number ) CREATE TABLE certificate ( eid number, aid number ) ...
SELECT destination, COUNT(*) FROM flight GROUP BY destination
spider
CREATE TABLE table_name_92 ( area_km² VARCHAR, density__hab_km²_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the area of the city with a density of 8,546.1?
SELECT area_km² FROM table_name_92 WHERE density__hab_km²_ = "8,546.1"
sql_create_context
CREATE TABLE table_name_62 ( home VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Home team on January 24, 1947?
SELECT home FROM table_name_62 WHERE date = "january 24, 1947"
sql_create_context
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, ZYLBDM text, ZYMC text ) CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGD...
SELECT COUNT(DISTINCT hz_info.RYBH) FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE mzjzjlb.ZZYSGH = '82477447' AND mzjzjlb.JZKSRQ BETWEEN '2002-11-04' AND '2014-02-23'
css
CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER ) CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Return a histogram on how o...
SELECT gender, AVG(age) FROM Person GROUP BY gender ORDER BY gender DESC
nvbench
CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, t...
SELECT DISTINCT advisory_requirement FROM course WHERE department = 'LATINOAM' AND number = 313
advising
CREATE TABLE table_72506 ( "Position" real, "Club (City/Town)" text, "Games Played" real, "W-L-D" text, "Goals For/Against" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what's the w-l-d with position being 1
SELECT "W-L-D" FROM table_72506 WHERE "Position" = '1'
wikisql
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, ...
SELECT CONCAT('http://stackoverflow.com/q/', Posts.Id) AS "Question URL", Posts.Title AS "Post Title", Posts.CreationDate AS "Post Date", Posts.Tags AS "Tags", Posts.Score AS "Score", Posts.AnswerCount AS "Number of Responses", Posts.AcceptedAnswerId AS "Answered?" FROM Posts JOIN PostTags ON PostTags.PostId = Posts.Id...
sede
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownV...
WITH revisions_cte AS (SELECT DISTINCT p.Id AS pid, ph1.Id AS phId FROM PostHistory AS ph1 INNER JOIN Posts AS p ON ph1.PostId = p.Id WHERE ph1.PostHistoryTypeId IN (3, 6, 9) AND ph1.Text LIKE '%<##tagName##>%' AND NOT (p.Tags LIKE '%<##tagName##>%')), firstrev_cte AS (SELECT pid, MIN(ph2.Id) AS MinId FROM revisions_ct...
sede
CREATE TABLE table_name_45 ( gold VARCHAR, nation VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many golds does Germany have?
SELECT gold FROM table_name_45 WHERE nation = "germany"
sql_create_context
CREATE TABLE table_23512864_4 ( speaker VARCHAR, chief_minister VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the speaker if the chief minister is M.G. Ramachandran?
SELECT speaker FROM table_23512864_4 WHERE chief_minister = "M.G. Ramachandran"
sql_create_context
CREATE TABLE table_name_67 ( status VARCHAR, census_ranking VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the status of the community with a census ranking of 2,418 of 5,008?
SELECT status FROM table_name_67 WHERE census_ranking = "2,418 of 5,008"
sql_create_context
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 ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14671) AND icustays.outtime IS NULL) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_i...
mimic_iii
CREATE TABLE tags ( index number, id number, tag text ) CREATE TABLE torrents ( groupname text, totalsnatched number, artist text, groupyear number, releasetype text, groupid number, id number ) -- Using valid SQLite, answer the following questions for the tables provided abov...
SELECT releasetype FROM torrents GROUP BY releasetype ORDER BY SUM(totalsnatched) DESC LIMIT 10
whatcdhiphop
CREATE TABLE Apartments ( apt_id INTEGER, building_id INTEGER, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, bedroom_count INTEGER, room_count CHAR(5) ) CREATE TABLE Guests ( guest_id INTEGER, gender_code CHAR(1), guest_first_name VARCHAR(80), guest_la...
SELECT booking_end_date, COUNT(booking_end_date) FROM Apartment_Bookings ORDER BY COUNT(booking_end_date) DESC
nvbench
CREATE TABLE table_name_59 ( opponent VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On 10/20/1979*, who was the Opponent?
SELECT opponent FROM table_name_59 WHERE date = "10/20/1979*"
sql_create_context
CREATE TABLE table_28230 ( "Stage" real, "Winner" text, "General classification" text, "Points classification" text, "Mountains classification" text, "Young rider classification" text, "Team classification" text, "Combativity award" text ) -- Using valid SQLite, answer the following qu...
SELECT COUNT("Mountains classification") FROM table_28230 WHERE "Winner" = 'Rui Costa'
wikisql
CREATE TABLE table_14049 ( "Polling firm" text, "Dates" text, "Prog. Cons." text, "New Democratic" text, "Liberal" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- According to the August 2008 poll that reported 36% New Demcratic, what percentage alig...
SELECT "Liberal" FROM table_14049 WHERE "New Democratic" = '36%' AND "Dates" = 'august 2008'
wikisql
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREAT...
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 = '015-23047')) AND diagnosis.diagnosisname = 'diabetes mellitus'
eicu