instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, s...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19428 AND admissions.dischtime IS NULL) AND transfers.careunit = 'ccu' ORDER BY transfers.intime LIMIT 1
mimic_iii
CREATE TABLE table_204_418 ( id number, "date" text, "opponent" text, "score" text, "overall record" text, "scba record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many games were played in total ?
SELECT COUNT(*) FROM table_204_418
squall
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE countries ( COUNTRY_ID...
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
nvbench
CREATE TABLE table_204_442 ( id number, "institution" text, "location" text, "enrollment" number, "nickname" text, "varsity\nsports" number, "rugby\nsince" text, "head coach" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which instituti...
SELECT "institution" FROM table_204_442 ORDER BY "enrollment" DESC LIMIT 1
squall
CREATE TABLE table_name_29 ( league_division VARCHAR, location VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What League/Division has a Location of n/a?
SELECT league_division FROM table_name_29 WHERE location = "n/a"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) CREATE TABLE mzjzjlb ( YLJGDM text, JZLSH text, KH text, KLX number, MJZH text, HZXM text, NLS number, NLY number, ZSEBZ number, JZZTDM number, JZZTMC text, JZJSSJ time, TXBZ number,...
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB ...
css
CREATE TABLE table_75478 ( "Year" text, "Overall Record" text, "Conference Record" text, "Coach" text, "Conference" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the conference record for the year of 1971?
SELECT "Conference Record" FROM table_75478 WHERE "Year" = '1971'
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
SELECT prescriptions.drug_type, prescriptions.route FROM prescriptions WHERE prescriptions.formulary_drug_cd = "POSA200L"
mimicsql_data
CREATE TABLE table_47224 ( "Player" text, "Nationality" text, "Jersey Number(s)" text, "Position" text, "Years" text, "From" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What years were from Connecticut?
SELECT "Years" FROM table_47224 WHERE "From" = 'connecticut'
wikisql
CREATE TABLE table_name_75 ( message VARCHAR, designation_hd VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What message has hd 186408 as a designation HD?
SELECT message FROM table_name_75 WHERE designation_hd = "hd 186408"
sql_create_context
CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) CREATE TABLE Apartment_Bookings ( apt_bookin...
SELECT facility_code, COUNT(facility_code) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4 GROUP BY facility_code ORDER BY COUNT(facility_code) DESC
nvbench
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "SINGLE" AND diagnoses.long_title = "Hemochromatosis due to repeated red blood cell transfusions"
mimicsql_data
CREATE TABLE table_name_21 ( value__ VARCHAR, team VARCHAR, revenue__$m_ VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the total number of value for revenue more than 193 and rank less than 12 for manchester united
SELECT COUNT(value__) AS $m_ FROM table_name_21 WHERE revenue__$m_ > 193 AND rank < 12 AND team = "manchester united"
sql_create_context
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
SELECT jybgb.BGDH FROM hz_info JOIN wdmzjzjlb JOIN jybgb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '03628207' AND jybgb.BGRQ BETWEEN '2005-02-07' AND '2015-...
css
CREATE TABLE table_49867 ( "Date" text, "Home team" text, "Score" text, "Away team" text, "Venue" text, "Box Score" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which home team had a score of 85-101?
SELECT "Home team" FROM table_49867 WHERE "Score" = '85-101'
wikisql
CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT COUNT(*) FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '水建茗' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2013-03-05' AND '2016-01-07' AND t_kc24.MED_AMOUT <= 10
css
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE ReviewTasks ( Id num...
SELECT p.OwnerUserId, u.DisplayName, DATE(p.CreationDate) AS "Date", CAST(p.CreationDate AS TIMESTAMP) AS "Time", p.ParentId FROM Posts AS p, Users AS u WHERE p.PostTypeId = 2 AND p.ParentId = @Question AND u.Id = OwnerUserId ORDER BY p.CreationDate
sede
CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), AllergyType VARCHAR(20) ) CREATE TABLE Has_Allergy ( StuID INTEGE...
SELECT T1.Allergy, COUNT(T1.Allergy) FROM Allergy_Type AS T1 JOIN Has_Allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = "Lisa" GROUP BY T1.Allergy
nvbench
CREATE TABLE table_25437 ( "Edition" text, "Round" text, "Date" text, "Against" text, "Surface" text, "Opponent" text, "W\u2013L" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the opponent for 3 6, 4 6, 6 1, 6 7 (7 9...
SELECT "Opponent" FROM table_25437 WHERE "Result" = '3–6, 4–6, 6–1, 6–7 (7–9)'
wikisql
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 jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jy...
css
CREATE TABLE 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 labevents ( row_id number, subject_id number, ...
SELECT MIN(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'allergic rhinitis nos') AND STRFTIME('%y', diagnoses_icd.charttime) <= '2104' GROUP BY STRFTIME('%y', ...
mimic_iii
CREATE TABLE table_name_86 ( high_rebounds VARCHAR, high_assists VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is High Rebounds, when High Assists is 'Delonte West (10)'?
SELECT high_rebounds FROM table_name_86 WHERE high_assists = "delonte west (10)"
sql_create_context
CREATE TABLE Movie ( mID VARCHAR, year VARCHAR ) CREATE TABLE Rating ( mID VARCHAR, stars VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find all years that have a movie that received a rating of 4 or 5, and sort them in increasing order of year.
SELECT DISTINCT year FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year
sql_create_context
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND prescriptions.drug = "Influenza Virus Vaccine"
mimicsql_data
CREATE TABLE table_77939 ( "Player" text, "Date of Birth" text, "Batting Style" text, "Bowling Style" text, "First Class Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What first class team does sanath jayasuriya play for?
SELECT "First Class Team" FROM table_77939 WHERE "Player" = 'sanath jayasuriya'
wikisql
CREATE TABLE table_23315 ( "Verbs" text, "Yo" text, "T\u00fa" text, "Vos (*)" text, "\u00c9l / Ella / Usted" text, "Nosotros / Nosotras" text, "Vosotros / Vosotras" text, "Ellos / Ellas / Ustedes" text ) -- Using valid SQLite, answer the following questions for the tables provided abov...
SELECT COUNT("Verbs") FROM table_23315 WHERE "Yo" = 'sienta'
wikisql
CREATE TABLE table_203_530 ( id number, "country" text, "gdp (usd bln, 2012)" number, "gdp (usd bln, 2017)" number, "gdp (usd ppp bln, 2012)" number, "gdp (usd ppp bln, 2017)" number, "per capita (usd, 2012)" number, "per capita (usd, 2017)" number, "per capita (usd ppp, 2012)" numbe...
SELECT ABS((SELECT "gdp (usd bln, 2012)" FROM table_203_530 WHERE "country" = 'albania') - (SELECT "gdp (usd bln, 2012)" FROM table_203_530 WHERE "country" = 'algeria'))
squall
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, ...
SELECT (SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-8658' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1) AND NOT patient.admissionweight IS NULL ORD...
eicu
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDa...
SELECT COUNT(*) FROM Users
sede
CREATE TABLE ref_attraction_types ( attraction_type_code text, attraction_type_description text ) CREATE TABLE features ( feature_id number, feature_details text ) CREATE TABLE tourist_attraction_features ( tourist_attraction_id number, feature_id number ) CREATE TABLE staff ( staff_id nu...
SELECT DISTINCT location_name FROM locations
spider
CREATE TABLE table_name_59 ( representative VARCHAR, termination_of_mission VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which representative has a Termination of MIssion date Mar 25, 1976?
SELECT representative FROM table_name_59 WHERE termination_of_mission = "mar 25, 1976"
sql_create_context
CREATE TABLE table_name_19 ( country VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What country is ranked 79?
SELECT country FROM table_name_19 WHERE rank = 79
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 zyjybgb.BGDH FROM zyjybgb WHERE zyjybgb.JZLSH = '56388294537' AND zyjybgb.KSMC LIKE '%导管%' UNION SELECT mzjybgb.BGDH FROM mzjybgb WHERE mzjybgb.JZLSH = '56388294537' AND mzjybgb.KSMC LIKE '%导管%'
css
CREATE TABLE table_49483 ( "Rifle" text, "Danish Krag-J\u00f8rgensen 1889" text, "US Krag-J\u00f8rgensen M1892" text, "Norwegian Krag-J\u00f8rgensen M1894" text, "Japanese Type 38 Rifle" text, "German Gewehr 98" text, "British Lee-Enfield (data for late model)" text ) -- Using valid SQLite...
SELECT "British Lee-Enfield (data for late model)" FROM table_49483 WHERE "Japanese Type 38 Rifle" = '5'
wikisql
CREATE TABLE table_52028 ( "Player" text, "Nationality" text, "Position" text, "Years for Jazz" text, "School/Club Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Year for Jazz club of Houston?
SELECT "Years for Jazz" FROM table_52028 WHERE "School/Club Team" = 'houston'
wikisql
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostHistory ( Id number, Po...
SELECT Id AS "post_link", Tags, LastActivityDate FROM Posts WHERE Posts.Id IN (SELECT PostTags.PostId FROM PostTags INNER JOIN Tags ON Tags.Id = PostTags.TagId WHERE Tags.TagName IN ('ggplot2', 'lattice', 'plyr', 'data.frame', 'sweave', 'lapply', 'sapply', 'r') GROUP BY PostTags.PostId HAVING COUNT(CASE WHEN Tags.TagNa...
sede
CREATE TABLE addresses ( address_id number, line_1 text, line_2 text, city text, zip_postcode text, state_province_county text, country text ) CREATE TABLE people_addresses ( person_address_id number, person_id number, address_id number, date_from time, date_to time ) C...
SELECT T2.student_details FROM student_course_registrations AS T1 JOIN students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.registration_date DESC LIMIT 1
spider
CREATE TABLE table_204_822 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which country won the same amount of medals as bulgaria in these ...
SELECT "nation" FROM table_204_822 WHERE "nation" <> 'bulgaria' AND "total" = (SELECT "total" FROM table_204_822 WHERE "nation" = 'bulgaria')
squall
CREATE TABLE table_204_620 ( id number, "title" text, "year" number, "language" text, "role" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what title is before dhol in 2007 ?
SELECT "title" FROM table_204_620 WHERE id = (SELECT id FROM table_204_620 WHERE "title" = 'dhol') - 1
squall
CREATE TABLE table_19041 ( "Episode" text, "Original Air Date" text, "Viewers (millions)" text, "Presenter" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where was held the ceremony for the 12th Pride of Britain Awards?
SELECT "Location" FROM table_19041 WHERE "Episode" = '12th Pride of Britain Awards'
wikisql
CREATE TABLE table_name_62 ( language VARCHAR, music_director VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What language does Raj Kamal speak?
SELECT language FROM table_name_62 WHERE music_director = "raj kamal"
sql_create_context
CREATE TABLE table_76279 ( "Season" real, "Date" text, "Winner" text, "Score [C ]" text, "Venue" text, "Competition round" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What venue had an event on 17 November 1963?
SELECT "Venue" FROM table_76279 WHERE "Season" = '1963' AND "Date" = '17 november 1963'
wikisql
CREATE TABLE table_66188 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Date of the Ameritech Senior Open?
SELECT "Date" FROM table_66188 WHERE "Tournament" = 'ameritech senior open'
wikisql
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswer...
SELECT COUNT(*) FROM Posts
sede
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following questions for the...
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Code DESC
nvbench
CREATE TABLE table_67362 ( "Name" text, "Species Authority" text, "Order" text, "Family" text, "Red List" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest Red List for the muridae family and species Authority of microtus pinetorum ...
SELECT MAX("Red List") FROM table_67362 WHERE "Family" = 'muridae' AND "Species Authority" = 'microtus pinetorum (le conte, 1830)'
wikisql
CREATE TABLE table_12911 ( "Elector" text, "Nationality" text, "Order" text, "Title" text, "Elevated" text, "Elevator" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Elevator has a Title of bishop of palestrina?
SELECT "Elevator" FROM table_12911 WHERE "Title" = 'bishop of palestrina'
wikisql
CREATE TABLE photos ( id int, camera_lens_id int, mountain_id int, color text, name text ) CREATE TABLE mountain ( id int, name text, Height real, Prominence real, Range text, Country text ) CREATE TABLE camera_lens ( id int, brand text, name text, focal_len...
SELECT brand, COUNT(brand) FROM camera_lens GROUP BY brand ORDER BY brand DESC
nvbench
CREATE TABLE Person ( name VARCHAR, gender VARCHAR, age INTEGER ) CREATE TABLE person ( name VARCHAR, gender VARCHAR, age INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the youngest male?
SELECT name FROM Person WHERE gender = 'male' AND age = (SELECT MIN(age) FROM Person WHERE gender = 'male')
sql_create_context
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, char...
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 366) AND microbiologyevents.spec_type_desc = 'mrsa screen' AND DATETIME(microbiologyevents.charttime) <= DATETIME(CURRENT_TIME(), '-1 year')
mimic_iii
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following questions for the...
SELECT Founder, AVG(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY AVG(Manufacturer)
nvbench
CREATE TABLE table_5943 ( "Draw" real, "Artist" text, "Song" text, "Jury" real, "Televote" real, "Total" real, "Place" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Place is the highest one that has an Artist of nikolas metaxas, and a...
SELECT MAX("Place") FROM table_5943 WHERE "Artist" = 'nikolas metaxas' AND "Televote" > '60'
wikisql
CREATE TABLE table_name_65 ( name VARCHAR, constituency_number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the name of Constituency number 108?
SELECT name FROM table_name_65 WHERE constituency_number = "108"
sql_create_context
CREATE TABLE table_54910 ( "Rd #" real, "Pick #" real, "Player" text, "Team (League)" text, "Reg GP" real, "Pl GP" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When Steve Hazlett is the Player, and the PI GP is under 0, what is the average Rd ...
SELECT AVG("Rd #") FROM table_54910 WHERE "Player" = 'steve hazlett' AND "Pl GP" < '0'
wikisql
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 transfers ( row_id number,...
SELECT COUNT(*) > 0 FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 40059)
mimic_iii
CREATE TABLE albums ( aid number, title text, year number, label text, type text ) CREATE TABLE instruments ( songid number, bandmateid number, instrument text ) CREATE TABLE band ( id number, firstname text, lastname text ) CREATE TABLE performance ( songid number, ...
SELECT T2.lastname FROM performance AS T1 JOIN band AS T2 ON T1.bandmate = T2.id WHERE stageposition = "back" GROUP BY lastname ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_i...
mimic_iii
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 jybgb.SHSJ FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_info.XM = '赵思美' AND jybg...
css
CREATE TABLE table_221315_3 ( usaf_space_flights VARCHAR, max_speed__mph_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What were all USAF space flights when the aximum speed was 3822?
SELECT usaf_space_flights FROM table_221315_3 WHERE max_speed__mph_ = 3822
sql_create_context
CREATE TABLE table_29501 ( "Number" real, "Player" text, "Position" text, "Seasons by team" text, "Year of induction into Pro Football Hall of Fame" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was Will Shields inducted into the Pro Football ...
SELECT "Year of induction into Pro Football Hall of Fame" FROM table_29501 WHERE "Player" = 'Will Shields'
wikisql
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 SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 11826 AND admissions.dischtime IS NULL) AND prescriptions.drug = 'heparin sodium'
mimic_iii
CREATE TABLE table_54414 ( "Pick #" real, "CFL Team" text, "Player" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which pick number attended McMaster College?
SELECT "Pick #" FROM table_54414 WHERE "College" = 'mcmaster'
wikisql
CREATE TABLE table_name_51 ( metres VARCHAR, feet INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of Metres wiht a Feet that's smaller than 196?
SELECT COUNT(metres) FROM table_name_51 WHERE feet < 196
sql_create_context
CREATE TABLE table_55689 ( "Season" real, "Series Name" text, "Champion" text, "Team Champion" text, "Secondary Class Champion" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the seasons where Marcello Puglisi (formula master italia) was th...
SELECT SUM("Season") FROM table_55689 WHERE "Secondary Class Champion" = 'marcello puglisi (formula master italia)'
wikisql
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) -- Using valid SQLite, answer the following questions for the...
SELECT Headquarter, MAX(Revenue) FROM Manufacturers GROUP BY Headquarter ORDER BY MAX(Revenue)
nvbench
CREATE TABLE qtb ( CLINIC_ID 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, INSU_TYPE text, IN...
SELECT AVG(qtb.IN_HOSP_DAYS) FROM qtb WHERE qtb.MED_SER_ORG_NO = '6831757' AND qtb.IN_HOSP_DATE BETWEEN '2006-09-17' AND '2011-03-29' UNION SELECT AVG(gyb.IN_HOSP_DAYS) FROM gyb WHERE gyb.MED_SER_ORG_NO = '6831757' AND gyb.IN_HOSP_DATE BETWEEN '2006-09-17' AND '2011-03-29' UNION SELECT AVG(zyb.IN_HOSP_DAYS) FROM zyb WH...
css
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD ...
SELECT t_kc22.MED_ORG_DEPT_CD, t_kc22.MED_ORG_DEPT_NM FROM t_kc22 WHERE t_kc22.STA_DATE BETWEEN '2000-08-12' AND '2018-10-18' AND t_kc22.MED_INV_ITEM_TYPE = '手术费' GROUP BY t_kc22.MED_ORG_DEPT_CD ORDER BY COUNT(*) LIMIT 12
css
CREATE TABLE table_6019 ( "Year" real, "Artist" text, "Title" text, "Genre" text, "Label" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what year was cryptogramophon released
SELECT "Year" FROM table_6019 WHERE "Label" = 'cryptogramophon'
wikisql
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following questions for the...
SELECT Code, Price FROM Products WHERE Price BETWEEN 60 AND 120 GROUP BY Name
nvbench
CREATE TABLE table_79109 ( "Round" text, "Circuit" text, "Date" text, "Winning driver" text, "Winning team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the round on 30 June with a.z.k./roc-comp tition a.z.k./roc-comp tition as the winning...
SELECT "Round" FROM table_79109 WHERE "Winning team" = 'a.z.k./roc-compétition a.z.k./roc-compétition' AND "Date" = '30 june'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
SELECT demographic.age, lab.fluid FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.subject_id = "2560"
mimicsql_data
CREATE TABLE table_37692 ( "Rank" text, "Urban sub-area" text, "Population" text, "Status" text, "Council area" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the urban sub-area with an East Dunbartonshire council area and a population of 19...
SELECT "Urban sub-area" FROM table_37692 WHERE "Council area" = 'east dunbartonshire' AND "Population" = '19,020'
wikisql
CREATE TABLE player ( pid number, pname text, ycard text, hs number ) CREATE TABLE college ( cname text, state text, enr number ) CREATE TABLE tryout ( pid number, cname text, ppos text, decision text ) -- Using valid SQLite, answer the following questions for the tables ...
SELECT cname FROM college WHERE enr > 18000 ORDER BY cname
spider
CREATE TABLE phone_market ( Market_ID int, Phone_ID text, Num_of_stock int ) CREATE TABLE market ( Market_ID int, District text, Num_of_employees int, Num_of_shops real, Ranking int ) CREATE TABLE phone ( Name text, Phone_ID int, Memory_in_G int, Carrier text, Price...
SELECT Carrier, AVG(Memory_in_G) FROM phone GROUP BY Carrier ORDER BY AVG(Memory_in_G) DESC
nvbench
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.expire_flag = "1" AND diagnoses.icd9_code = "261"
mimicsql_data
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 zyjybgb.BBCJBW FROM hz_info JOIN mzjzjlb JOIN zyjybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '83925055' AND zyjybgb.BGRQ BETWEEN '2007-12-02' AND '2008-...
css
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time...
SELECT Tags.TagName, AVG(CAST(Posts.Score AS FLOAT)) AS avg, COUNT(Posts.Id) AS count FROM Tags LEFT JOIN Posts ON Posts.Tags LIKE '%' + Tags.TagName + '%' GROUP BY Tags.TagName HAVING COUNT(Posts.Id) >= 5 ORDER BY avg DESC LIMIT 1
sede
CREATE TABLE table_51383 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When the Total is less than 1, and Bronze is 0, how many Gold medals are there?
SELECT SUM("Gold") FROM table_51383 WHERE "Bronze" = '0' AND "Total" < '1'
wikisql
CREATE TABLE table_name_40 ( game INTEGER, march VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- March of 29 involves what highest scoring game?
SELECT MAX(game) FROM table_name_40 WHERE march = 29
sql_create_context
CREATE TABLE table_72086 ( "No. in set" real, "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- The episode with production c...
SELECT "Original air date" FROM table_72086 WHERE "Production code" = '9ABX02'
wikisql
CREATE TABLE table_19423 ( "State/UT Code" real, "India/State/UT" text, "Literate Persons (%)" text, "Males (%)" text, "Females (%)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the percentage of females where in India and are maharashtra?...
SELECT "Females (%)" FROM table_19423 WHERE "India/State/UT" = 'Maharashtra'
wikisql
CREATE TABLE county_public_safety ( county_id number, name text, population number, police_officers number, residents_per_officer number, case_burden number, crime_rate number, police_force text, location text ) CREATE TABLE city ( city_id number, county_id number, name ...
SELECT name FROM city WHERE county_id = (SELECT county_id FROM county_public_safety ORDER BY police_officers DESC LIMIT 1)
spider
CREATE TABLE table_50536 ( "Season" text, "Skip" text, "Third" text, "Second" text, "Lead" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the skip that has a third of Anna Sloan in season 2012-13?
SELECT "Skip" FROM table_50536 WHERE "Third" = 'anna sloan' AND "Season" = '2012-13'
wikisql
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 84042) AND prescriptions.drug IN ('hydromorphone p.f.', 'fentanyl patch', 'vial') AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-57 month')
mimic_iii
CREATE TABLE table_name_12 ( time_retired VARCHAR, grid VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- I want the time/retired for grid of 24
SELECT time_retired FROM table_name_12 WHERE grid = 24
sql_create_context
CREATE TABLE table_38310 ( "Start month" text, "End month" text, "Cover" text, "Spine" text, "Indicia" text, "Masthead" text, "Number of issues" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which spine has 12 issues?
SELECT "Spine" FROM table_38310 WHERE "Number of issues" = '12'
wikisql
CREATE TABLE table_32109 ( "Year" real, "Play" text, "Role" text, "Theatre" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the lowest year for shubert theatre
SELECT MIN("Year") FROM table_32109 WHERE "Theatre" = 'shubert theatre'
wikisql
CREATE TABLE table_11250_4 ( top_division_titles INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the least top division titles?
SELECT MIN(top_division_titles) FROM table_11250_4
sql_create_context
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
SELECT STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', patient.hospitaladmittime) FROM patient WHERE patient.uniquepid = '010-20205' AND NOT patient.hospitaladmittime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1
eicu
CREATE TABLE table_43511 ( "Season" text, "Competition" text, "Round" text, "Opponent" text, "Home" text, "Away" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which round has an opponent of Freiburg?
SELECT "Round" FROM table_43511 WHERE "Opponent" = 'freiburg'
wikisql
CREATE TABLE table_11104 ( "Suburb" text, "Population (in 2008)" real, "Median age (in 2006)" text, "Mean household size (in 2006)" text, "Area (km\u00b2)" real, "Density (/km\u00b2)" real, "Date first settled as a suburb" real, "Gazetted as a Division Name" text ) -- Using valid SQLit...
SELECT AVG("Area (km\u00b2)") FROM table_11104 WHERE "Density (/km\u00b2)" = '263'
wikisql
CREATE TABLE table_name_4 ( position VARCHAR, years_for_rockets VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For the years 1992-93, what position did he play for the Houston Rockets?
SELECT position FROM table_name_4 WHERE years_for_rockets = "1992-93"
sql_create_context
CREATE TABLE table_23308178_8 ( points INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the largest number of points they had?
SELECT MAX(points) FROM table_23308178_8
sql_create_context
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following questions for the...
SELECT Name, MAX(Revenue) FROM Manufacturers GROUP BY Headquarter
nvbench
CREATE TABLE jybgb_jyjgzbb ( JYZBLSH number, YLJGDM text, jyjgzbb_id 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 person_info.XM FROM person_info JOIN hz_info JOIN zyjzjlb JOIN jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND zyjzjlb.YLJGDM = jybgb.YLJGDM_ZYJZJLB AND zyjzjlb.JZLSH = jybgb.JZLSH_ZYJZJLB WHERE jybgb.BGDH = '20186568174'
css
CREATE TABLE table_10315 ( "Sport" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the total number of Bronze for futsal
SELECT COUNT("Bronze") FROM table_10315 WHERE "Sport" = 'futsal'
wikisql
CREATE TABLE table_18373863_2 ( year_drafted INTEGER, years_played VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When 2005 is the year played what is the lowest year drafted?
SELECT MIN(year_drafted) FROM table_18373863_2 WHERE years_played = "2005"
sql_create_context
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 ACC_Road, School_ID FROM basketball_match GROUP BY ACC_Home, ACC_Road ORDER BY ACC_Road DESC
nvbench
CREATE TABLE table_59025 ( "Stage" text, "Winner" text, "General Classification" text, "Mountains Classification" text, "Points Classification" text, "Sprints classification" text, "Team Classification" text ) -- Using valid SQLite, answer the following questions for the tables provided ab...
SELECT "General Classification" FROM table_59025 WHERE "Mountains Classification" = 'david loosli' AND "Stage" = '3'
wikisql
CREATE TABLE table_19156 ( "High School" text, "Type" text, "Established" real, "Enrollment" real, "Mascot" text, "WIAA Classification" text, "Notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was Mount Tahoma established?
SELECT MAX("Established") FROM table_19156 WHERE "High School" = 'Mount Tahoma'
wikisql