instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
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 procedures ( ...
SELECT prescriptions.formulary_drug_cd FROM prescriptions WHERE prescriptions.drug = "D5NS"
mimicsql_data
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE ReviewRejectionReasons ( Id number, Na...
SELECT Id AS "post_link", CreationDate FROM Posts WHERE NOT AnswerCount IS NULL AND AnswerCount < 1 AND Tags LIKE '%<##TagName##>%' ORDER BY CreationDate DESC
sede
CREATE TABLE table_10160447_1 ( points VARCHAR, driver VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what's the points with driver rusty wallace
SELECT points FROM table_10160447_1 WHERE driver = "Rusty Wallace"
sql_create_context
CREATE TABLE Catalogs ( catalog_id INTEGER, catalog_name VARCHAR(50), catalog_publisher VARCHAR(80), date_of_publication DATETIME, date_of_latest_revision DATETIME ) CREATE TABLE Catalog_Contents ( catalog_entry_id INTEGER, catalog_level_number INTEGER, parent_entry_id INTEGER, prev...
SELECT catalog_level_name, catalog_level_number FROM Catalog_Structure WHERE catalog_level_number BETWEEN 5 AND 10 ORDER BY catalog_level_number DESC
nvbench
CREATE TABLE table_204_330 ( id number, "finished" text, "horse" text, "jockey" text, "trainer" text, "owner" text, "time / behind" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the name of the first jockey on this chart ?
SELECT "jockey" FROM table_204_330 WHERE id = 1
squall
CREATE TABLE table_32276 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the away team that scored 12.11 (83)?
SELECT "Away team" FROM table_32276 WHERE "Away team score" = '12.11 (83)'
wikisql
CREATE TABLE table_38514 ( "Games" real, "Drawn" real, "Lost" real, "Goal difference" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest lost that has 6 for points?
SELECT MAX("Lost") FROM table_38514 WHERE "Points" = '6'
wikisql
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
SELECT zyjzjlb.JZKSDM, zyjzjlb.JZKSMC FROM zyjzjlb WHERE zyjzjlb.JZLSH = '81908444288'
css
CREATE TABLE table_name_85 ( pos VARCHAR, asts VARCHAR, rebs VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the position of the player with more than 11 assists and 219 rebounds?
SELECT pos FROM table_name_85 WHERE asts > 11 AND rebs = 219
sql_create_context
CREATE TABLE table_19115414_4 ( mountains_classification VARCHAR, team_classification VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the mountains classification for team columbia
SELECT mountains_classification FROM table_19115414_4 WHERE team_classification = "Team Columbia"
sql_create_context
CREATE TABLE table_24039173_1 ( captain VARCHAR, location VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the captain in Chaguaramas?
SELECT captain FROM table_24039173_1 WHERE location = "Chaguaramas"
sql_create_context
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.short_title = "Closed bronchial biopsy"
mimicsql_data
CREATE TABLE table_34589 ( "Game" real, "November" real, "Opponent" text, "Score" text, "Record" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average points on November 6?
SELECT AVG("Points") FROM table_34589 WHERE "November" = '6'
wikisql
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost numbe...
SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'aspirin (chewable)' AND patient.uniquepid = '017-47390' AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME()...
eicu
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.days_stay = "30"
mimicsql_data
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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decima...
SELECT LAST_NAME, MANAGER_ID FROM employees ORDER BY LAST_NAME DESC
nvbench
CREATE TABLE table_41724 ( "Name" text, "Position" text, "Number" real, "School/Club Team" text, "Season" text, "Acquisition via" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For which school/club team did the player in the position of Guard/F...
SELECT "School/Club Team" FROM table_41724 WHERE "Position" = 'guard/forward'
wikisql
CREATE TABLE table_204_696 ( id number, "issue" number, "volume" number, "title" text, "main feature story" text, "first/early appearance story/stories" text, "release date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- tell me the only one...
SELECT "title" FROM table_204_696 WHERE "release date" = 2013 AND "release date" = 12
squall
CREATE TABLE table_name_71 ( week INTEGER, game_site VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Week has a Game site of oakland-alameda county coliseum, and an Attendance larger than 52,169?
SELECT MIN(week) FROM table_name_71 WHERE game_site = "oakland-alameda county coliseum" AND attendance > 52 OFFSET 169
sql_create_context
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN student_record ON student_record.course_id = course.course_id INNER JOIN program_course ON student_record.course_id = program_course.course_id WHERE program_course.category LIKE '%ULCS%' AND student_record.student_id = 1
advising
CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Tit...
SELECT Posts.Id, Comments.Score, Comments.Text FROM Posts INNER JOIN Comments ON Comments.PostId = Posts.Id WHERE Comments.UserId = @UserId AND Posts.OwnerUserId = @OtherUserId ORDER BY Comments.Score DESC
sede
CREATE TABLE table_47666 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Round" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which opponent has 1-1 as the record?
SELECT "Opponent" FROM table_47666 WHERE "Record" = '1-1'
wikisql
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE cost ( costid number, ...
SELECT COUNT(*) 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 STRFTIME('%y-%m',...
eicu
CREATE TABLE table_13241 ( "Position" text, "Player" text, "Loaned to" text, "Date" text, "Loan expires" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What player loaned to of Leeds United?
SELECT "Player" FROM table_13241 WHERE "Loaned to" = 'leeds united'
wikisql
CREATE TABLE table_10527215_3 ( fastest_lap VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was Datsun Twin 200's fastest lap?
SELECT fastest_lap FROM table_10527215_3 WHERE name = "Datsun Twin 200"
sql_create_context
CREATE TABLE Customers_Cards ( card_type_code VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show the number of card types.
SELECT COUNT(DISTINCT card_type_code) FROM Customers_Cards
sql_create_context
CREATE TABLE table_28462 ( "Modern English day name" text, "Old English day name" text, "English day name meaning" text, "Glossed from Latin day name" text, "Latin day name meaning" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the meaning ...
SELECT "Latin day name meaning" FROM table_28462 WHERE "Glossed from Latin day name" = 'Dies Saturni'
wikisql
CREATE TABLE table_20917 ( "Series #" real, "Season #" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What episode titles have 17....
SELECT "Title" FROM table_20917 WHERE "U.S. viewers (millions)" = '17.93'
wikisql
CREATE TABLE table_name_7 ( binomial VARCHAR, binary VARCHAR, fibonacci VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Binary of (log n), and a Fibonacci of (1) has what binomial?
SELECT binomial FROM table_name_7 WHERE binary = "θ(log n)" AND fibonacci = "θ(1)"
sql_create_context
CREATE TABLE table_name_33 ( rank VARCHAR, nationality VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the rank for Denmark?
SELECT COUNT(rank) FROM table_name_33 WHERE nationality = "denmark"
sql_create_context
CREATE TABLE table_68788 ( "Team" text, "City" text, "Founded" real, "First season in Segunda Divisi\u00f3n" real, "First season of current spell in Segunda Divisi\u00f3n" real, "Stadium" text, "Capacity" real, "Field" text, "Top division titles" real, "Last top division title" t...
SELECT MIN("Capacity") FROM table_68788 WHERE "First season in Segunda Divisi\u00f3n" = '2013' AND "Top division titles" > '0'
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, COUNT(DISTINCT T1.Name) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code ORDER BY Headquarter DESC
nvbench
CREATE TABLE table_name_10 ( team VARCHAR, assists VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- I want the team with assists greater than 118 and rank less than 2
SELECT team FROM table_name_10 WHERE assists > 118 AND rank < 2
sql_create_context
CREATE TABLE table_name_26 ( nat VARCHAR, estimate VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which nation was the ship from that had 372 victims?
SELECT nat FROM table_name_26 WHERE estimate = "372"
sql_create_context
CREATE TABLE table_9916 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What place is the player from the United States with a to par of e?
SELECT "Place" FROM table_9916 WHERE "Country" = 'united states' AND "To par" = 'e'
wikisql
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ...
SELECT u.DisplayName, COUNT(1) AS answers_count, SUM(a.Score) AS total_score, SUM(a.Score) * 1.0 / COUNT(1) AS avg_score FROM Users AS u JOIN Posts AS a ON u.Id = a.OwnerUserId AND a.PostTypeId = 2 GROUP BY u.Id, u.DisplayName ORDER BY avg_score DESC, answers_count DESC
sede
CREATE TABLE table_203_561 ( id number, "pos" number, "team" text, "total" number, "high" number, "low" number, "average" number, "change" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- the team that is last in terms of total
SELECT "team" FROM table_203_561 ORDER BY "total" LIMIT 1
squall
CREATE TABLE table_37440 ( "School Year" text, "Class A" text, "Class AA" text, "Class AAA" text, "Class AAAA" text, "Class AAAAA" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the class AAAA with class A of lindsay and class AAAAA of gale...
SELECT "Class AAAA" FROM table_37440 WHERE "Class A" = 'lindsay' AND "Class AAAAA" = 'galena park north shore'
wikisql
CREATE TABLE table_name_27 ( city VARCHAR, airport VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which city is Naples Airport located in?
SELECT city FROM table_name_27 WHERE airport = "naples airport"
sql_create_context
CREATE TABLE settlements ( settlement_id number, claim_id number, effective_date time, settlement_amount number ) CREATE TABLE first_notification_of_loss ( fnol_id number, customer_id number, policy_id number, service_id number ) CREATE TABLE available_policies ( policy_id number, ...
SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = "Close a policy" INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_...
spider
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(gwyjzb.MED_SER_ORG_NO) FROM gwyjzb WHERE gwyjzb.PERSON_NM = '苏家欣' AND gwyjzb.IN_HOSP_DATE BETWEEN '2000-02-24' AND '2009-04-29' UNION SELECT COUNT(fgwyjzb.MED_SER_ORG_NO) FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '苏家欣' AND fgwyjzb.IN_HOSP_DATE BETWEEN '2000-02-24' AND '2009-04-29'
css
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 Id AS "post_link", * FROM Posts WHERE Id = 3896392
sede
CREATE TABLE table_41715 ( "Date" text, "Opponent" text, "Result" text, "Score" text, "Record" text, "attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What team was the Opponent when the Score was 31-6?
SELECT "Opponent" FROM table_41715 WHERE "Score" = '31-6'
wikisql
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
SELECT COUNT(*) FROM Users AS u WHERE u.Reputation >= 3000 AND YEAR(u.LastAccessDate) >= 2019
sede
CREATE TABLE table_name_41 ( date_of_departure VARCHAR, replaced_by VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was the departure date when a manager was replaced by Bojan Pra nikar?
SELECT date_of_departure FROM table_name_41 WHERE replaced_by = "bojan prašnikar"
sql_create_context
CREATE TABLE table_45168 ( "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. -- How ma...
SELECT "High assists" FROM table_45168 WHERE "Date" = 'november 27'
wikisql
CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE airport ( ...
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 = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBU...
atis
CREATE TABLE table_5457 ( "s Car plate (starting 1937)" text, "Voivodeship or city" text, "Capital" text, "Area (1930) in 1,000skm 2" text, "Population (1931) in 1,000s" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Capital of brze nad bugiem has w...
SELECT "Area (1930) in 1,000skm 2" FROM table_5457 WHERE "Capital" = 'brześć nad bugiem'
wikisql
CREATE TABLE table_name_77 ( date VARCHAR, winning_driver VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was pedro rodr guez the winning driver?
SELECT date FROM table_name_77 WHERE winning_driver = "pedro rodríguez"
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 SUM(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 49369)) AND DATETIME(outputevents.charttime) >= DATETIME(CURRENT_TIME(), '-932 day')
mimic_iii
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 All_Home, AVG(School_ID) FROM basketball_match GROUP BY All_Home ORDER BY AVG(School_ID)
nvbench
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
SELECT t_kc21.MED_ORG_DEPT_CD, t_kc21.IN_DIAG_DIS_NM, MAX(t_kc24.CIVIL_SUBSIDY / t_kc24.MED_AMOUT) FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.MED_SER_ORG_NO = '0573118' GROUP BY t_kc21.MED_ORG_DEPT_CD, t_kc21.IN_DIAG_DIS_NM ORDER BY MAX(t_kc24.CIVIL_SUBSIDY / t_kc24.MED_AMOUT) D...
css
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 diagnoses ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.days_stay > "14"
mimicsql_data
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, ...
SELECT MIN(PostTypes.Name) AS Name, COUNT(*) AS Count FROM Posts, PostTypes WHERE Posts.PostTypeId = PostTypes.Id GROUP BY PostTypes.Id ORDER BY Count DESC
sede
CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE offering_instructor ( ...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND program_course.category LIKE '%PreMajor%' AND program_course.course_id = course.course_id AND semester.semester = 'FA' AND semester.semester_id = co...
advising
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age te...
SELECT patient.age FROM patient WHERE patient.uniquepid = '002-17348' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1
eicu
CREATE TABLE table_55173 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest grid value with fewer than 17 laps and constructor Sauber - Petronas?
SELECT MIN("Grid") FROM table_55173 WHERE "Laps" < '17' AND "Constructor" = 'sauber - petronas'
wikisql
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate n...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'neurology consu...
eicu
CREATE TABLE table_78704 ( "Tournament" text, "1992" text, "1993" text, "1994" text, "1995" text, "1996" text, "1997" text, "1998" text, "1999" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text ) -- Using valid SQLite, answer...
SELECT "Tournament" FROM table_78704 WHERE "2000" = 'a'
wikisql
CREATE TABLE table_32289 ( "Date" text, "Time" text, "Epicenter" text, "Magnitude" text, "Fatalities" text, "Name" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Magnitude on the Date May 28, 2004?
SELECT "Magnitude" FROM table_32289 WHERE "Date" = 'may 28, 2004'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2190" AND procedures.icd9_code = "8855"
mimicsql_data
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose...
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1372) AND prescriptions.drug = 'furosemide' AND STRFTIME('%y-%m', prescriptions.startdate) <= '2101-07'
mimic_iii
CREATE TABLE table_1971074_1 ( enrollment INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the highest enrollment among the schools?
SELECT MAX(enrollment) FROM table_1971074_1
sql_create_context
CREATE TABLE table_54016 ( "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. -- Which team plays at the Arden Street Oval?
SELECT "Away team" FROM table_54016 WHERE "Venue" = 'arden street oval'
wikisql
CREATE TABLE table_203_521 ( id number, "year" number, "division" number, "league" text, "regular season" text, "playoffs" text, "open cup" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which results were listed the most under the playoffs ...
SELECT "playoffs" FROM table_203_521 GROUP BY "playoffs" ORDER BY COUNT(*) DESC LIMIT 1
squall
CREATE TABLE table_11906 ( "Week" text, "Date" text, "Opponent" text, "Result" text, "Kickoff [a ]" text, "Game site" text, "Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When the result was l 13-7 ot, who was...
SELECT "Opponent" FROM table_11906 WHERE "Result" = 'l 13-7 ot'
wikisql
CREATE TABLE table_15179 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest total from United States with a Rank smaller than 2?
SELECT MIN("Total") FROM table_15179 WHERE "Nation" = 'united states' AND "Rank" < '2'
wikisql
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
SELECT PER_SOL FROM t_kc24 WHERE MED_CLINIC_ID = '79030741932'
css
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 Affiliation, SUM(Enrollment) FROM university WHERE Founded > 1850 GROUP BY Affiliation
nvbench
CREATE TABLE table_203_664 ( id number, "club" text, "town" text, "founded" number, "nickname" text, "colours" text, "home ground" text, "titles" number, "website" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many teams are fro...
SELECT COUNT("club") FROM table_203_664 WHERE "town" = 'morwell'
squall
CREATE TABLE table_203_358 ( id number, "pos." number, "athlete" text, "run 1" number, "run 2" number, "total" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who completed run 1 in the least amount of time ?
SELECT "athlete" FROM table_203_358 ORDER BY "run 1" LIMIT 1
squall
CREATE TABLE table_8844 ( "Year" real, "Ship" text, "Departed From" text, "Departed On" text, "Returned On" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When did TDB depart?
SELECT MAX("Year") FROM table_8844 WHERE "Departed From" = 'tdb'
wikisql
CREATE TABLE table_36000 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Away team has a Score of 0 3?
SELECT "Away team" FROM table_36000 WHERE "Score" = '0–3'
wikisql
CREATE TABLE table_25594 ( "Stage" real, "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 "Winner" FROM table_25594 WHERE "Sprints classification" = 'no award'
wikisql
CREATE TABLE table_55586 ( "Stage (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 above. -- W...
SELECT "Team Classification" FROM table_55586 WHERE "General Classification" = 'vladimir karpets' AND "Mountains Classification" = 'no award'
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 demographic.age, demographic.language FROM demographic WHERE demographic.subject_id = "17595"
mimicsql_data
CREATE TABLE table_name_47 ( broadcasts__tv__1 INTEGER, series VARCHAR, us_release_date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of Broadcasts (TV) 1, when Series is '3 4', and when US Release Date is '27 December 2006'?
SELECT SUM(broadcasts__tv__1) FROM table_name_47 WHERE series = "3 4" AND us_release_date = "27 december 2006"
sql_create_context
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 Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREAT...
SELECT Sex, MAX(Age) FROM Student GROUP BY Sex ORDER BY Sex
nvbench
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.KSBM, jybgb.KSMC FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN hz_info_mzjzjlb ON hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH...
css
CREATE TABLE table_50680 ( "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 w...
SELECT "High assists" FROM table_50680 WHERE "Game" = '66'
wikisql
CREATE TABLE table_name_15 ( democratic VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the 2008 Status of Rosa Delauro?
SELECT 2008 AS _status FROM table_name_15 WHERE democratic = "rosa delauro"
sql_create_context
CREATE TABLE table_name_52 ( frequency_mhz INTEGER, erp_w VARCHAR, call_sign VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Frequency MHz that has a ERP W larger than 205, and a Call sign of k230ap?
SELECT MAX(frequency_mhz) FROM table_name_52 WHERE erp_w > 205 AND call_sign = "k230ap"
sql_create_context
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 varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE departments ( DEPARTME...
SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY HIRE_DATE DESC
nvbench
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0...
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID) DESC
nvbench
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
SELECT CIVIL_SUBSIDY FROM t_kc24 WHERE MED_CLINIC_ID = '00268317219'
css
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE T...
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 = 'ld, body fluid')) AND DATETIME(cost.chargetime) >= DATETIME(CURRENT_TIME(), '-5 year') GROUP BY cost....
mimic_iii
CREATE TABLE table_3096 ( "Theatre name" text, "Digital Screens" real, "IMAX Screens" real, "Location" text, "Language of films" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the total number of language of films for m ga-plex taschereau imax
SELECT COUNT("Language of films") FROM table_3096 WHERE "Theatre name" = 'Méga-Plex Taschereau IMAX'
wikisql
CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId numbe...
SELECT * FROM Comments WHERE Id = 86023446
sede
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wa...
SELECT microlab.organism FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-44495')) AND microlab.culturesite = 'sputum, expectorated' AND DATETI...
eicu
CREATE TABLE table_name_71 ( title VARCHAR, year VARCHAR, original_channel VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the title when the year is after 2011 and the original channel is nhk?
SELECT title FROM table_name_71 WHERE year > 2011 AND original_channel = "nhk"
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "68" AND prescriptions.formulary_drug_cd = "MAAL30L"
mimicsql_data
CREATE TABLE table_25592 ( "Stage" real, "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 "Team classification" FROM table_25592 WHERE "Stage" = '9'
wikisql
CREATE TABLE table_58355 ( "Position" text, "Game 1" text, "Game 2" text, "Game 3" text, "Game 4" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Game 1 has a fullback?
SELECT "Game 1" FROM table_58355 WHERE "Position" = 'fullback'
wikisql
CREATE TABLE table_25883 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Series" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who ha...
SELECT "High rebounds" FROM table_25883 WHERE "Game" = '2'
wikisql
CREATE TABLE authors ( authid number, lname text, fname text ) CREATE TABLE papers ( paperid number, title text ) CREATE TABLE inst ( instid number, name text, country text ) CREATE TABLE authorship ( authid number, instid number, paperid number, authorder number ) -...
SELECT fname FROM authors ORDER BY fname
spider
CREATE TABLE table_name_64 ( college VARCHAR, position VARCHAR, pick__number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which College has a Position of ol, and a Pick # smaller than 32?
SELECT college FROM table_name_64 WHERE position = "ol" AND pick__number < 32
sql_create_context
CREATE TABLE table_45342 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "Location Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT IS THE RECORD FOR FEBRUARY 11?
SELECT "Record" FROM table_45342 WHERE "Date" = 'february 11'
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 prescriptions ( subject_id text, hadm_id...
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.icd9_code = "V489" AND prescriptions.drug_type = "ADDITIVE"
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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "36" AND lab."CATEGORY" = "Chemistry"
mimicsql_data
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 Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Dorm ( dormid INTEGE...
SELECT Fname, COUNT(Fname) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' GROUP BY Fname ORDER BY Fname DESC
nvbench