instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE Posts ...
SELECT COUNT(Id) AS "number_of_users" FROM Users WHERE Reputation >= '##minrep##'
sede
CREATE TABLE diagnoses_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 DISTINCT cost.cost FROM cost WHERE cost.event_type = 'diagnoses_icd' AND cost.event_id IN (SELECT diagnoses_icd.row_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'gal&bil cal w/ac&chr w/o'))
mimic_iii
CREATE TABLE diagnoses_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 d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT outputevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM outputevents WHERE DATETIME(outputevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY outputevents.itemid) AS...
mimic_iii
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 COUNT(*) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-53416')) AND treatment.treatmentname = 'cpap/peep therapy - 5-10 cm h2o' AND...
eicu
CREATE TABLE table_25085059_1 ( pick__number INTEGER, college VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What draft pick number did Kentucky get?
SELECT MIN(pick__number) FROM table_25085059_1 WHERE college = "Kentucky"
sql_create_context
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT gwyjzb.IN_DIAG_DIS_NM, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '9681293' GROUP BY gwyjzb.IN_DIAG_DIS_NM UNION SELECT fgwyjzb.IN_DIAG_DIS_NM, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '9681293' GROUP BY fgwyjzb.IN_DIAG_DIS_NM
css
CREATE TABLE table_56889 ( "Race" text, "Circuit" text, "Date" text, "Pole position" text, "Fastest lap" text, "Winning driver" text, "Constructor" text, "Tyre" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me th...
SELECT "Date" FROM table_56889 WHERE "Fastest lap" = 'jody scheckter' AND "Race" = 'french grand prix'
wikisql
CREATE TABLE table_name_5 ( qual VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the qual for rank 20?
SELECT qual FROM table_name_5 WHERE rank = "20"
sql_create_context
CREATE TABLE table_26829 ( "Branding" text, "Callsign" text, "Frequency" text, "Power kW" text, "Coverage" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How much power covers dumaguete central visayas region?
SELECT COUNT("Power kW") FROM table_26829 WHERE "Coverage" = 'Dumaguete Central Visayas Region'
wikisql
CREATE TABLE table_1341395_33 ( candidates VARCHAR, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who were the candidates when gregory w. meeks was the incumbent
SELECT candidates FROM table_1341395_33 WHERE incumbent = "Gregory W. Meeks"
sql_create_context
CREATE TABLE table_44545 ( "Tournament" text, "1990" text, "1991" text, "1992" text, "1993" text, "1994" text, "1995" text, "1996" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is 1993, when Tournament is 'Cincinnati'?
SELECT "1993" FROM table_44545 WHERE "Tournament" = 'cincinnati'
wikisql
CREATE TABLE Movie ( mID int, title text, year int, director text ) CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Pleas...
SELECT title, SUM(stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY title ORDER BY SUM(stars)
nvbench
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25...
SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY JOB_ID
nvbench
CREATE TABLE table_32342 ( "Round" real, "Overall" real, "Player" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the average round where Dave Stachelski was picked smaller than 187.
SELECT AVG("Round") FROM table_32342 WHERE "Overall" < '187' AND "Player" = 'dave stachelski'
wikisql
CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational...
SELECT DISTINCT instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'AT' AND course.number = 313 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.off...
advising
CREATE TABLE table_204_376 ( id number, "date" text, "venue" text, "opponents" text, "score" text, "competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which date is listed after july 20th , 2012 ?
SELECT "date" FROM table_204_376 WHERE id = (SELECT id FROM table_204_376 WHERE "date" = '20 july 2012') + 1
squall
CREATE TABLE Parts ( part_name VARCHAR, part_id VARCHAR ) CREATE TABLE Part_Faults ( part_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which kind of part has the least number of faults? List the part name.
SELECT T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name ORDER BY COUNT(*) LIMIT 1
sql_create_context
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE T...
SELECT Id AS "post_link", Body FROM Posts WHERE Body LIKE '%lightsabre%'
sede
CREATE TABLE table_74112 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text, "Position in table" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is t...
SELECT "Position in table" FROM table_74112 WHERE "Outgoing manager" = 'Alfredo Merino'
wikisql
CREATE TABLE table_17318 ( "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's...
SELECT MIN("Game") FROM table_17318
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE wdmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, K...
SELECT COUNT(*) FROM (SELECT jybgb.KSBM FROM wdmzjzjlb JOIN jybgb ON wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE wdmzjzjlb.YLJGDM = '5070509' AND jybgb.BGRQ BETWEEN '2012-03-19' AND '2015-07-19' GROUP BY jybgb.KSBM HAVING COUNT(*) >= 26 UNION SELECT jybgb.KSBM FROM bdmzjzjlb ...
css
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC...
SELECT person_info.XM FROM person_info JOIN hz_info JOIN zyjzjlb JOIN jybgb JOIN hz_info_zyjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND hz_info_zyjzjlb.YLJGDM = jybgb.YLJGDM_ZYJZJLB AND zyjzjlb.JZLSH = jybgb.JZLSH_ZYJZ...
css
CREATE TABLE table_22106 ( "Rank" real, "Airport Name" text, "Location" text, "IATA Code" text, "Tonnes" text, "% Chg. 2010/11" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many tonnes of cargo did the airport have with the IATA Code IND?
SELECT "Tonnes" FROM table_22106 WHERE "IATA Code" = 'IND'
wikisql
CREATE TABLE table_24807406_3 ( goals INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the lowest goals ever achieved?
SELECT MIN(goals) FROM table_24807406_3
sql_create_context
CREATE TABLE table_24838 ( "Episode number" real, "Title" text, "Original airing on Channel 4" text, "Time of airing on Channel 4" text, "Original airing on E4" text, "Time of airing on E4" text, "Position in Channel 4s ratings a" text, "Position in E4s ratings b" text, "Total viewer...
SELECT "Original airing on Channel 4" FROM table_24838 WHERE "Title" = 'Being Alive'
wikisql
CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TAB...
SELECT DISTINCT flight.flight_id FROM aircraft, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, equipment_sequence, flight WHERE (aircraft.basic_type = '727' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND equipment_sequ...
atis
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 intakeoutput ( intakeoutpu...
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT lab.patientunitstayid FROM lab WHERE lab.labname = 't3ru')) GROUP BY cost.patienthealthsystemstayid) AS t1
eicu
CREATE TABLE table_80180 ( "Year" text, "Start" text, "Qual" text, "Rank" text, "Finish" text, "Laps" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year was the ranking 1?
SELECT "Year" FROM table_80180 WHERE "Rank" = '1'
wikisql
CREATE TABLE table_79012 ( "Rank (2012)" real, "IATA Code" text, "Major City Served" text, "State" text, "2012" real, "2011" real, "2010" real, "2009" real, "2008" real, "2007" real, "2006" real, "2005" real ) -- Using valid SQLite, answer the following questions for th...
SELECT MAX("2010") FROM table_79012 WHERE "State" = 'fl' AND "Major City Served" = 'miami'
wikisql
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE lab ( labid number, pa...
SELECT patient.wardid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-103228' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1) ORDER BY patient.unitadmittime LIMIT 1
eicu
CREATE TABLE table_43910 ( "Rank" real, "Company" text, "Headquarters" text, "Industry" text, "Sales (billion $)" real, "Profits (billion $)" real, "Assets (billion $)" real, "Market Value (billion $)" real ) -- Using valid SQLite, answer the following questions for the tables provided...
SELECT COUNT("Rank") FROM table_43910 WHERE "Assets (billion $)" < '248.44' AND "Industry" = 'oil and gas' AND "Headquarters" = 'france' AND "Market Value (billion $)" > '152.62'
wikisql
CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDat...
SELECT * FROM Votes WHERE VoteTypeId = 6 AND CreationDate >= '2014-08-01 00:00:00'
sede
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID
nvbench
CREATE TABLE orders ( customer_id VARCHAR, order_status VARCHAR ) CREATE TABLE customers ( customer_details VARCHAR, customer_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find the details of all the distinct customers who have orders with statu...
SELECT DISTINCT T1.customer_details FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "On Road"
sql_create_context
CREATE TABLE staff_department_assignments ( staff_id number, department_id number, date_assigned_from time, job_title_code text, date_assigned_to time ) CREATE TABLE addresses ( address_id number, address_details text ) CREATE TABLE department_store_chain ( dept_store_chain_id number, ...
SELECT staff_id FROM staff_department_assignments WHERE date_assigned_to < (SELECT MAX(date_assigned_to) FROM staff_department_assignments WHERE job_title_code = 'Clerical Staff')
spider
CREATE TABLE table_25608 ( "Star" text, "Stellar classification" text, "Distance from Earth ( ly )" text, "Constellation" text, "Dust (or Debris; Temperature (K)" text, "System" text, "Dust (or Debris) Location (AU)" text, "Cool Dust > 10 AU" text, "Stellar Age (Myr)" text ) -- Usi...
SELECT "Dust (or Debris; Temperature (K)" FROM table_25608 WHERE "Star" = 'η Corvi'
wikisql
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '何修明' AND t_kc22.STA_DATE BETWEEN '2013-12-16' AND '2014-11-24' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC LIMIT 1
css
CREATE TABLE mzjzjlb_jybgb ( YLJGDM_MZJZJLB text, BGDH number, YLJGDM number ) CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC te...
SELECT mzjzjlb.KH, mzjzjlb.KLX FROM mzjzjlb WHERE mzjzjlb.JZLSH = '14556788521'
css
CREATE TABLE table_7293 ( "Place (Posici\u00f3n)" real, "Team (Equipo)" text, "Played (PJ)" real, "Won (PG)" real, "Draw (PE)" real, "Lost (PP)" real, "Goals Scored (GF)" real, "Goals Conceded (GC)" real, "+/- (Dif.)" real, "Points (Pts.)" real ) -- Using valid SQLite, answer t...
SELECT SUM("Points (Pts.)") FROM table_7293 WHERE "Place (Posici\u00f3n)" > '8'
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Cardiac arrest" AND prescriptions.drug_type = "MAIN"
mimicsql_data
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 zyjzjlb.JZKSDM, zyjzjlb.JZKSMC FROM zyjzjlb WHERE zyjzjlb.JZLSH = '49765892512'
css
CREATE TABLE table_37584 ( "Date" text, "Label" text, "Region" text, "Format" text, "Catalog" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Label released a CD single in 1993?
SELECT "Label" FROM table_37584 WHERE "Format" = 'cd single' AND "Date" = '1993'
wikisql
CREATE TABLE table_name_21 ( attendance VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the number in attendance for the Detroit Lions game?
SELECT attendance FROM table_name_21 WHERE opponent = "detroit lions"
sql_create_context
CREATE TABLE table_4789 ( "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. -- When the VFL played at Junction Oval what was the...
SELECT "Away team score" FROM table_4789 WHERE "Venue" = 'junction oval'
wikisql
CREATE TABLE player_award_vote ( award_id text, year number, league_id text, player_id text, points_won number, points_max number, votes_first text ) CREATE TABLE player_award ( player_id text, award_id text, year number, league_id text, tie text, notes text ) CREAT...
SELECT T1.player_id, T1.award_id, MIN(T1.year - T2.birth_year) FROM player_award AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id GROUP BY T1.award_id
thehistoryofbaseball
CREATE TABLE table_17700 ( "Rank in Nyagatare Sectors, 2012" real, "Sector" text, "Area in sqkm" real, "Population August 15, 2012" real, "Population, August 15, 2002" real, "Population Change 2002-2012 (%)" text, "Population Density 2012 (km 2 )" real ) -- Using valid SQLite, answer the f...
SELECT COUNT("Population August 15, 2012") FROM table_17700 WHERE "Sector" = 'Gatunda'
wikisql
CREATE TABLE table_1341604_10 ( first_elected VARCHAR, district VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what's the first elected with district being florida 7
SELECT first_elected FROM table_1341604_10 WHERE district = "Florida 7"
sql_create_context
CREATE TABLE table_42118 ( "Position" real, "Channel" text, "Launch date" real, "Owner" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text, "2013 (p)" real ) -- Using valid SQLite, answer the following questi...
SELECT "2007" FROM table_42118 WHERE "Position" = '6'
wikisql
CREATE TABLE table_49290 ( "Rider" text, "Manufacturer" text, "Laps" real, "Time" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When the Grids is less than 2 what are the total laps?
SELECT COUNT("Laps") FROM table_49290 WHERE "Grid" < '2'
wikisql
CREATE TABLE table_79901 ( "Ride name" text, "Type" text, "Opened in" real, "Themed land" text, "Manufacturer" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What type of ride is Rameses Revenge?
SELECT "Type" FROM table_79901 WHERE "Ride name" = 'rameses revenge'
wikisql
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TAB...
SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355')) AND microlab.culturesite = 'blood, venipuncture' AND DATETIME(micr...
eicu
CREATE TABLE table_68428 ( "Episode" text, "First aired" text, "Entrepreneur(s)" text, "Company or product name" text, "Money requested (\u00a3)" real, "Investing Dragon(s)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which company or product...
SELECT "Company or product name" FROM table_68428 WHERE "Money requested (\u00a3)" > '35,000' AND "Investing Dragon(s)" = 'peter jones'
wikisql
CREATE TABLE table_28490105_1 ( distance VARCHAR, supporting VARCHAR, tc_winning_car VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the distance in the round where the supporter was champ car world series ( grand prix of cleveland ) and the tc w...
SELECT distance FROM table_28490105_1 WHERE supporting = "Champ Car World Series ( Grand Prix of Cleveland )" AND tc_winning_car = "Pierre Kleinubing"
sql_create_context
CREATE TABLE table_4457 ( "Shipyard" text, "Laid down" text, "Launched" text, "Commissioned" text, "Fleet" text, "Status" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me what was commissioned december 30, 1965
SELECT "Commissioned" FROM table_4457 WHERE "Launched" = 'december 30, 1965'
wikisql
CREATE TABLE table_38623 ( "Nation" text, "T Score" real, "A Score" real, "E Score" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How large was the total when the E Score was greater than 9.35 and T Score was less than 4?
SELECT MAX("Total") FROM table_38623 WHERE "E Score" > '9.35' AND "T Score" < '4'
wikisql
CREATE TABLE table_13344 ( "Township" text, "County" text, "Pop. (2010)" real, "Land ( sqmi )" real, "Water (sqmi)" real, "Latitude" real, "Longitude" real, "GEO ID" real, "ANSI code" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- wh...
SELECT MAX("ANSI code") FROM table_13344 WHERE "Latitude" > '47.623288' AND "GEO ID" > '3805508060' AND "Land ( sqmi )" > '35.66' AND "Longitude" < '-102.054248'
wikisql
CREATE TABLE table_name_14 ( crowd INTEGER, home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Crowd has a Home team of richmond?
SELECT SUM(crowd) FROM table_name_14 WHERE home_team = "richmond"
sql_create_context
CREATE TABLE table_40997 ( "Date" text, "Opponent" text, "Location" text, "Result" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the opponent when the result was L 0-14?
SELECT "Opponent" FROM table_40997 WHERE "Result" = 'l 0-14'
wikisql
CREATE TABLE table_name_11 ( wk_3 INTEGER, wk_11 VARCHAR, wk_14 VARCHAR, wk_2 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest wk 3 value with an n/r in wk 14, a wk 2 value of 7, and a wk 11 value greater than 18?
SELECT MIN(wk_3) FROM table_name_11 WHERE wk_14 = "n/r" AND wk_2 = 7 AND wk_11 > 18
sql_create_context
CREATE TABLE table_534 ( "Series #" real, "Season #" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date did the episode called 'Responsible Parties' air on?
SELECT "Original air date" FROM table_534 WHERE "Title" = 'Responsible Parties'
wikisql
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 WHERE demographic.religion = "JEWISH" AND demographic.age < "30"
mimicsql_data
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "LEFT AGAINST MEDICAL ADVI" AND procedures.short_title = "Coronar arteriogr-1 cath"
mimicsql_data
CREATE TABLE table_12227 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" real, "Finish" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the average to par for lee trevino?
SELECT AVG("To par") FROM table_12227 WHERE "Player" = 'lee trevino'
wikisql
CREATE TABLE table_203_457 ( id number, "tramway" text, "country" text, "city" text, "height of pylons" text, "span width,\nleaning straight line" text, "span width,\nhorizontal measurement" text, "height of cable over ground" text, "year of inauguration" number, "notes" text ) ...
SELECT COUNT("tramway") FROM table_203_457 WHERE "country" = 'france'
squall
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.insurance = "Self Pay" AND diagnoses.long_title = "Other preterm infants, 1,250-1,499 grams"
mimicsql_data
CREATE TABLE list ( lastname text, firstname text, grade number, classroom number ) CREATE TABLE teachers ( lastname text, firstname text, classroom number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which are the first and last names of the ...
SELECT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "MARROTTE" AND T2.lastname = "KIRK"
spider
CREATE TABLE schedule ( Cinema_ID int, Film_ID int, Date text, Show_times_per_day int, Price float ) CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_season int, Title text, Directed_by text, Original_air_date text, Production_code text ) CREATE TABLE cine...
SELECT Date, AVG(Price) FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID JOIN cinema AS T3 ON T1.Cinema_ID = T3.Cinema_ID GROUP BY Date ORDER BY AVG(Price) DESC
nvbench
CREATE TABLE table_41744 ( "Position" text, "Jersey #" real, "Name" text, "Height (cm)" real, "Weight (kg)" real, "Birthdate" text, "Birthplace" text, "2002\u20132003 Team" text, "NHL rights, if any" text ) -- Using valid SQLite, answer the following questions for the tables provid...
SELECT SUM("Weight (kg)") FROM table_41744 WHERE "Birthdate" = 'june 2, 1983'
wikisql
CREATE TABLE table_21091157_1 ( date VARCHAR, game VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the date for game 8
SELECT date FROM table_21091157_1 WHERE game = 8
sql_create_context
CREATE TABLE table_24513 ( "Regional" text, "Champions" text, "Runners-up" text, "Third place" text, "Fourth place" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who got the third position when laranja kyoto got the second position?
SELECT "Third place" FROM table_24513 WHERE "Runners-up" = 'Laranja Kyoto'
wikisql
CREATE TABLE table_32894 ( "Region" text, "Host" text, "Venue" text, "City" text, "State" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what state is the Thomas Assembly Center located?
SELECT "State" FROM table_32894 WHERE "Venue" = 'thomas assembly center'
wikisql
CREATE TABLE table_name_89 ( country VARCHAR, icao VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Country, when ICAO is 'Hesh'?
SELECT country FROM table_name_89 WHERE icao = "hesh"
sql_create_context
CREATE TABLE table_name_32 ( outcome VARCHAR, surface VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Outcome, when Surface is 'Carpet (I)', and when Date is '15 November 1993'?
SELECT outcome FROM table_name_32 WHERE surface = "carpet (i)" AND date = "15 november 1993"
sql_create_context
CREATE TABLE table_61175 ( "Club" text, "Nickname" text, "Location" text, "Home Ground" text, "GFL Premierships" text, "Years in GFL" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the club when home ground was Central Reserve?
SELECT "Club" FROM table_61175 WHERE "Home Ground" = 'central reserve'
wikisql
CREATE TABLE table_1568 ( "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. -- Against...
SELECT "Team" FROM table_1568 WHERE "Game" = '21'
wikisql
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, d...
SELECT patient.wardid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-64792') ORDER BY patient.unitadmittime LIMIT 1
eicu
CREATE TABLE parties ( party_id number, party_details text ) CREATE TABLE finances ( finance_id number, other_details text ) CREATE TABLE addresses ( address_id number, address_details text ) CREATE TABLE assets ( asset_id number, other_details text ) CREATE TABLE channels ( chan...
SELECT COUNT(*) FROM products
spider
CREATE TABLE table_53183 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many laps did the grid 1 engine have?
SELECT SUM("Laps") FROM table_53183 WHERE "Time/Retired" = 'engine' AND "Grid" = '1'
wikisql
CREATE TABLE table_204_981 ( id number, "ep#" number, "title" text, "broadcast date" text, "written by" text, "directed by" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- john considine and michael vejar worked on what episode together ?
SELECT "title" FROM table_204_981 WHERE "written by" = 'john considine' AND "directed by" = 'michael vejar'
squall
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), ...
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY JOB_ID DESC
nvbench
CREATE TABLE table_name_9 ( nation VARCHAR, bronze VARCHAR, silver VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What nation has 1 bronze and 3 silvers?
SELECT nation FROM table_name_9 WHERE bronze = "1" AND silver = "3"
sql_create_context
CREATE TABLE table_26561508_1 ( production_code VARCHAR, patient_portrayer VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the production code for the episode where the patient portrayer is Kathy Lamkin?
SELECT production_code FROM table_26561508_1 WHERE patient_portrayer = "Kathy Lamkin"
sql_create_context
CREATE TABLE table_204_84 ( id number, "no" number, "peak" text, "location" text, "elevation (m)" number, "prominence (m)" number, "col height (m)" number, "col location" text, "parent" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- ...
SELECT COUNT("peak") FROM table_204_84 WHERE "elevation (m)" > 4500
squall
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE fare ( fare_id int, ...
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, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'LAS VEGAS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN ...
atis
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT COUNT(*) FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_ID = '93401280' AND t_kc22.STA_DATE BETWEEN '2009-11-18' AND '2017-01-22' AND t_kc22.SELF_PAY_AMO > 7898.94 UNION SELECT COUNT(*) FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gyb.PERSON_ID = '9340...
css
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostFeedback ( Id number, PostId numb...
SELECT Name, COUNT(*) AS "count", TIME_TO_STR(Votes.CreationDate, '%-Hour') AS "hour", TIME_TO_STR(Votes.CreationDate, '%-mi%Mute') AS "minute", TIME_TO_STR(Votes.CreationDate, '%feco%M%-d') AS "second", TIME_TO_STR(Votes.CreationDate, '%-milli%S') AS "ms" FROM Votes JOIN VoteTypes ON VoteTypeId = VoteTypes.Id GROUP BY...
sede
CREATE TABLE table_name_50 ( round VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What round has hereford united as the opponent?
SELECT round FROM table_name_50 WHERE opponent = "hereford united"
sql_create_context
CREATE TABLE nuclear_power_plants ( id text, name text, latitude text, longitude text, country text, status text, reactortype text, reactormodel text, constructionstartat text, operationalfrom text, operationalto text, capacity text, lastupdatedat text, source tex...
SELECT country FROM nuclear_power_plants WHERE status = "Shutdown" GROUP BY country ORDER BY COUNT(name) DESC LIMIT 1
geonucleardata
CREATE TABLE table_79349 ( "Year" text, "Builder" text, "Model" text, "Length (ft)" real, "Propulsion" text, "Fleet series" text, "Total" text, "Notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which model with a fleet series of s41...
SELECT "Model" FROM table_79349 WHERE "Fleet series" = 's410-s434'
wikisql
CREATE TABLE table_name_52 ( bowling_style VARCHAR, first_class_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What bowling style does First Class Team, Griqualand West have?
SELECT bowling_style FROM table_name_52 WHERE first_class_team = "griqualand west"
sql_create_context
CREATE TABLE table_30204 ( "No." real, "Title" text, "Lyricist" text, "Composer" text, "Arrangement" text, "Sound Engineer" text, "Length" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many sound engineers were there for law hakon '3er ...
SELECT COUNT("Sound Engineer") FROM table_30204 WHERE "Title" = 'Law Hakon ''3er Leek'
wikisql
CREATE TABLE table_29909 ( "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. -- Who ha...
SELECT "High rebounds" FROM table_29909 WHERE "Date" = 'March 12'
wikisql
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, ...
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 = 'acc poison-adrener...
mimic_iii
CREATE TABLE table_name_43 ( manufacturer VARCHAR, fleet_numbers VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who manufactured fleet numbers of wlwr 2, 4, 11?
SELECT manufacturer FROM table_name_43 WHERE fleet_numbers = "wlwr 2, 4, 11"
sql_create_context
CREATE TABLE table_54790 ( "Type" text, "Sign" real, "Exponent" real, "Significand" real, "Total bits" real, "Exponent bias" real, "Bits precision" real, "Number of decimal digits" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's th...
SELECT MIN("Bits precision") FROM table_54790 WHERE "Total bits" < '16'
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 pl.PostId AS "post_link", COUNT(LinkTypeId) AS "Number of dupe-targets" FROM PostLinks AS pl WHERE pl.LinkTypeId = 3 GROUP BY pl.PostId ORDER BY 'Number of dupe-targets' DESC
sede
CREATE TABLE table_name_35 ( date VARCHAR, opponents VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Opponents of police, and a Venue of selayang municipal council stadium had what date?
SELECT date FROM table_name_35 WHERE opponents = "police" AND venue = "selayang municipal council stadium"
sql_create_context
CREATE TABLE table_4148 ( "Couple" text, "Week 1" real, "Week 2" real, "Week 3" real, "Week 4" text, "Week 5" text, "Week 6" text, "Week 7" text, "Week 8 Final" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the smallest week...
SELECT MIN("Week 3") FROM table_4148
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 COUNT(*) > 0 FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '003-39724')) AND DATETIME(allergy.allergytime) <= DATETIME(CURRENT_TIME(), '-1 y...
eicu
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.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM, t_kc22.QTY, t_kc22.UNIVALENT, t_kc22.AMOUNT FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_ID = '44478488' AND t_kc21.IN_HOSP_DATE BETWEEN '2016-10-10' AND '2018-03-11'
css