instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE 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.admityear < "2155" AND diagnoses.long_title = "Other specified gastritis, with hemorrhage"
mimicsql_data
CREATE TABLE table_65946 ( "Position" text, "Gymnast" text, "A Score" real, "B Score" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the B Score when the total is more than 16.125, and position is 3rd?
SELECT SUM("B Score") FROM table_65946 WHERE "Total" > '16.125' AND "Position" = '3rd'
wikisql
CREATE TABLE table_50932 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which country had a place of t1, as well as a score of 72-68-70-73=283?
SELECT "Country" FROM table_50932 WHERE "Place" = 't1' AND "Score" = '72-68-70-73=283'
wikisql
CREATE TABLE table_204_557 ( id number, "#" number, "date" text, "visitor" text, "score" text, "home" text, "record" text, "pts" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the name of first visitor on this chart ?
SELECT "visitor" FROM table_204_557 WHERE id = 1
squall
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 COUNT(*) FROM zyb WHERE zyb.PERSON_NM = '31926697' AND MOD(zyb.MED_CLINIC_ID, 1) = 0
css
CREATE TABLE table_11606 ( "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 played Footscray?
SELECT "Away team" FROM table_11606 WHERE "Home team" = 'footscray'
wikisql
CREATE TABLE table_39045 ( "Model" text, "Processors Supported" text, "FSB/HT Frequency (MHz)" text, "Memory" text, "PCI-Express" text, "SATA" text, "PATA" text, "Sound" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the process...
SELECT "Processors Supported" FROM table_39045 WHERE "Memory" = 'ddr2' AND "Model" = 'nforce 550'
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 ReviewTaskResults ( Id number, ReviewTaskId number, ...
SELECT Id AS "post_link", AnswerCount FROM Posts WHERE PostTypeId = 1 AND AcceptedAnswerId IS NULL AND OwnerUserId = '##UserId:int##'
sede
CREATE TABLE table_25286 ( "Constituency" text, "Winner" text, "Party" text, "Margin" real, "Runner-up a" text, "Party a" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the party when the constituency is 1. Chennai North?
SELECT "Party" FROM table_25286 WHERE "Constituency" = '1. Chennai North'
wikisql
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 COUNT(*) FROM zyb WHERE zyb.PERSON_NM = '94302117' AND MOD(zyb.MED_CLINIC_ID, 1) = 0
css
CREATE TABLE table_name_35 ( losses INTEGER, wimmera_fl VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Losses have a Wimmera FL of minyip murtoa?
SELECT AVG(losses) FROM table_name_35 WHERE wimmera_fl = "minyip murtoa"
sql_create_context
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 WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND demographic.dob_year < "2107"
mimicsql_data
CREATE TABLE table_79956 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who did they play on August 12?
SELECT "Opponent" FROM table_79956 WHERE "Date" = 'august 12'
wikisql
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "3" AND prescriptions.drug_type = "BASE"
mimicsql_data
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 OUT_DIAG_DIS_CD, OUT_DIAG_DIS_NM FROM t_kc21 WHERE PERSON_ID = '61340309' AND MED_SER_ORG_NO = '8931708' AND OUT_DIAG_DOC_NM LIKE '郑%'
css
CREATE TABLE table_name_75 ( year INTEGER, chassis VARCHAR, entrant VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year did Elf Team Tyrrell have 39 points and a Tyrrell 007 Chassis?
SELECT SUM(year) FROM table_name_75 WHERE entrant = "elf team tyrrell" AND points = "39" AND chassis = "tyrrell 007"
sql_create_context
CREATE TABLE table_36909 ( "Club" text, "Sport" text, "Founded" real, "League" text, "Venue" text, "Head Coach" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Venue of Pepsi arena involved what club?
SELECT "Club" FROM table_36909 WHERE "Venue" = 'pepsi arena'
wikisql
CREATE TABLE table_name_87 ( nationality VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Graham Gooch's nationality?
SELECT nationality FROM table_name_87 WHERE player = "graham gooch"
sql_create_context
CREATE TABLE table_60735 ( "Place" text, "Player" text, "Country" text, "Score" real, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Player has a To par of 2, and a Country of wales?
SELECT "Player" FROM table_60735 WHERE "To par" = '–2' AND "Country" = 'wales'
wikisql
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE icust...
SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20898)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt'...
mimic_iii
CREATE TABLE table_3813 ( "Sd" real, "Rk" real, "Player" text, "Points" real, "Points defending" text, "Points won" real, "New points" real, "Status" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many different counts for won points...
SELECT COUNT("Points won") FROM table_3813 WHERE "Player" = 'Flavia Pennetta'
wikisql
CREATE TABLE Documents_with_Expenses ( Document_ID INTEGER, Budget_Type_Code CHAR(15), Document_Details VARCHAR(255) ) CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15), Document_Type_Name VARCHAR(255), Document_Type_Description VARCHAR(255) ) CREATE TABLE Statements ( Statemen...
SELECT Document_Date, COUNT(Document_Date) FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code
nvbench
CREATE TABLE table_46421 ( "Name" text, "Country" text, "Loan Club" text, "Started" text, "Ended" text, "Start Source" text, "End Source" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was the loan started when the coutry is eng, the lo...
SELECT "Started" FROM table_46421 WHERE "Country" = 'eng' AND "Loan Club" = 'sunderland' AND "End Source" = 'south wales echo'
wikisql
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
SELECT SOC_SRT_DIRE_CD, SOC_SRT_DIRE_NM FROM t_kc22 WHERE MED_CLINIC_ID = '65610643384' AND HOSP_DOC_NM LIKE '姜%'
css
CREATE TABLE table_25663 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Prod. code" text, "Viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- ...
SELECT "Title" FROM table_25663 WHERE "Viewers (millions)" = '5.60'
wikisql
CREATE TABLE table_16360 ( "No. in series" real, "No. in season" real, "Title" text, "Director" text, "Writer(s)" text, "Original air date" text, "Production code" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When did the episode title 'Du...
SELECT "Original air date" FROM table_16360 WHERE "Title" = 'Duet for One'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "ACET650R"
mimicsql_data
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE hz_info ( KH text, KLX number...
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN zyjybgb 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 = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZ...
css
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 d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE chart...
SELECT MIN(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 22517)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admi...
mimic_iii
CREATE TABLE table_name_90 ( decision VARCHAR, home VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the decision of the game when Montreal was the home team?
SELECT decision FROM table_name_90 WHERE home = "montreal"
sql_create_context
CREATE TABLE table_40489 ( "Tournament" text, "2004" text, "2005" text, "2006" text, "2007" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the 2004 that has a of grand slam tournaments in2006 ?
SELECT "2004" FROM table_40489 WHERE "2006" = 'grand slam tournaments'
wikisql
CREATE TABLE table_23618 ( "Divisions" text, "Prize (EUR)" text, "Odds of winning (1in)" text, "Number of winning tickets" real, "In order to win" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which divisions have 565 as the number of winning ticke...
SELECT "Divisions" FROM table_23618 WHERE "Number of winning tickets" = '565'
wikisql
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
WITH counts_cte AS (SELECT LAST_DATE_OF_MONTH(p.CreationDate) AS Cmonth, SUM(Score) AS Score, SUM(ViewCount) AS Views FROM Posts AS p WHERE PostTypeId = 1 GROUP BY LAST_DATE_OF_MONTH(p.CreationDate)) SELECT Cmonth, 100 * (CAST(Score AS FLOAT)) / (CAST(Views AS FLOAT)) AS "score_per_view" FROM counts_cte ORDER BY Cmonth
sede
CREATE TABLE table_name_28 ( budget VARCHAR, film VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT IS THE BUDGET FOR THE INCREDIBLES?
SELECT budget FROM table_name_28 WHERE film = "the incredibles"
sql_create_context
CREATE TABLE table_46408 ( "Name" text, "Latitude" text, "Longitude" text, "Diameter (km)" real, "Year named" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the average year for the name aida-wedo dorsa with a diameter less than 450?
SELECT AVG("Year named") FROM table_46408 WHERE "Name" = 'aida-wedo dorsa' AND "Diameter (km)" < '450'
wikisql
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) 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, insuranc...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'sodium, urine') AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 's...
mimic_iii
CREATE TABLE table_43363 ( "Competition" text, "Appearances" real, "Played" real, "Drawn" real, "Lost" real, "Goals for" real, "Goals against" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total sum of the goals at competitions ...
SELECT SUM("Goals for") FROM table_43363 WHERE "Drawn" > '10'
wikisql
CREATE TABLE table_10236830_4 ( actors_name VARCHAR, nomination VARCHAR, country VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which actor from Serbia was nominated for best actor in a supporting role?
SELECT actors_name FROM table_10236830_4 WHERE nomination = "Best Actor in a Supporting Role" AND country = "Serbia"
sql_create_context
CREATE TABLE table_name_42 ( written_by VARCHAR, original_airdate VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who wrote the episode that originally aired on March 1, 1998?
SELECT written_by FROM table_name_42 WHERE original_airdate = "march 1, 1998"
sql_create_context
CREATE TABLE table_name_15 ( number VARCHAR, builder VARCHAR, works_number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- With a works number of 40864 for the builder of Baldwin Locomotive Works, the number listed is?
SELECT number FROM table_name_15 WHERE builder = "baldwin locomotive works" AND works_number = 40864
sql_create_context
CREATE TABLE table_1342379_5 ( candidates VARCHAR, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the incumbent when henry e. barbour ran?
SELECT candidates FROM table_1342379_5 WHERE incumbent = "Henry E. Barbour"
sql_create_context
CREATE TABLE head ( head_ID int, name text, born_state text, age real ) CREATE TABLE management ( department_ID int, head_ID int, temporary_acting text ) CREATE TABLE department ( Department_ID int, Name text, Creation text, Ranking int, Budget_in_Billions real, Num...
SELECT Creation, COUNT(Creation) FROM department ORDER BY Creation
nvbench
CREATE TABLE table_name_45 ( venue VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which venue was used 11 february 1996?
SELECT venue FROM table_name_45 WHERE date = "11 february 1996"
sql_create_context
CREATE TABLE table_12149 ( "Seat" real, "Series 1" text, "Series 3" text, "Series 4" text, "Series 5" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of seats with gavin duffy in series 4?
SELECT COUNT("Seat") FROM table_12149 WHERE "Series 4" = 'gavin duffy'
wikisql
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.diagnosis = "HYPOXIA"
mimicsql_data
CREATE TABLE table_1140114_5 ( winning_driver VARCHAR, circuit VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which driver won at the Sachsenring circuit?
SELECT winning_driver FROM table_1140114_5 WHERE circuit = "Sachsenring"
sql_create_context
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange ...
SELECT Tags.TagName, YEAR(DATE(Posts.CreationDate)) AS year, COUNT(Posts.Id) FROM Tags, PostTags, Posts WHERE Tags.TagName IN ('cassandra') AND Tags.Id = PostTags.TagId AND PostTags.PostId = Posts.Id AND Posts.CreationDate > '2013-01-01' AND Posts.CreationDate < '2021-01-01' GROUP BY Tags.TagName, YEAR(DATE(Posts.Creat...
sede
CREATE TABLE table_2401 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Sun Devils points" real, "Opponents" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many opponents did the Sun Devils play when they scor...
SELECT COUNT("Opponent") FROM table_2401 WHERE "Sun Devils points" = '41'
wikisql
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE cost ( row_id...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t4.icd9_code FROM (SELECT t3.icd9_code, DENSE_RANK() OVER (ORDER BY t3.c1 DESC) AS c2 FROM (SELECT t2.icd9_code, 100 - SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t2.chartt...
mimic_iii
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc22.MED_CLINIC_ID IN (SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_ID = '52953159' AND gwyjzb.MED_SER_ORG_NO = '3607978' AND gwyjzb.IN_HOSP_DATE BETWEEN '2015-08-12' AND '2015-10-01' UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb...
css
CREATE TABLE zzmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZ...
SELECT zzmzjzjlb.JZZTDM, zzmzjzjlb.JZZTMC FROM zzmzjzjlb WHERE zzmzjzjlb.JZLSH = '39436080954' UNION SELECT fzzmzjzjlb.JZZTDM, fzzmzjzjlb.JZZTMC FROM fzzmzjzjlb WHERE fzzmzjzjlb.JZLSH = '39436080954'
css
CREATE TABLE table_name_12 ( agg VARCHAR, team_1 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the agg for seba united
SELECT agg FROM table_name_12 WHERE team_1 = "seba united"
sql_create_context
CREATE TABLE table_name_20 ( attendance VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the attendance when the score was 88-98?
SELECT attendance FROM table_name_20 WHERE score = "88-98"
sql_create_context
CREATE TABLE table_77933 ( "Race Name" text, "Circuit" text, "Date" text, "Winning driver" text, "Constructor" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the race on 16 september?
SELECT "Race Name" FROM table_77933 WHERE "Date" = '16 september'
wikisql
CREATE TABLE table_1473672_3 ( nationality VARCHAR, nhl_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which nationality is the player from the Philadelphia Flyers?
SELECT nationality FROM table_1473672_3 WHERE nhl_team = "Philadelphia Flyers"
sql_create_context
CREATE TABLE table_1961 ( "Season" text, "League" text, "Division" text, "GP" real, "W" real, "L" real, "T" real, "OTL" real, "SOL" real, "Pts" real, "PCT" text, "GF" real, "GA" real, "PIM" real, "Coach(es)" text, "Result" text ) -- Using valid SQLite, a...
SELECT MIN("OTL") FROM table_1961
wikisql
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, C...
SELECT QPosts.ViewCount, QPosts.LastActivityDate, QPosts.Title, QPosts.Id, QPosts.Body, QPosts.AcceptedAnswerId AS "answer Id", APosts.Body FROM Posts AS QPosts, Posts AS APosts, PostTags WHERE (QPosts.Id = PostTags.PostId) AND (PostTags.TagId = 3) AND (QPosts.PostTypeId = 1) AND APosts.Id = QPosts.AcceptedAnswerId LIM...
sede
CREATE TABLE table_name_59 ( lead VARCHAR, second VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the lead for the team with Nkeiruka Ezekh as second?
SELECT lead FROM table_name_59 WHERE second = "nkeiruka ezekh"
sql_create_context
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE i...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'methylprednisolone sodium succ' AND DATETIME(prescriptions.startd...
mimic_iii
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 demographic.age, demographic.days_stay FROM demographic WHERE demographic.name = "Michelle Medina"
mimicsql_data
CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE...
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 ((flight.departure_time <= 2359 AND flight.departure_time >= 1200) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight....
atis
CREATE TABLE table_name_54 ( year VARCHAR, stages VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year was stage 8 reached?
SELECT year FROM table_name_54 WHERE stages = "8"
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 demographic.marital_status, demographic.age FROM demographic WHERE demographic.name = "Orville Ford"
mimicsql_data
CREATE TABLE table_13399573_3 ( points_for VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What amount of points for were there when there was 52 points?
SELECT points_for FROM table_13399573_3 WHERE points = "52"
sql_create_context
CREATE TABLE table_28059992_5 ( position VARCHAR, cfl_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What position did the draft pick going to saskatchewan play?
SELECT position FROM table_28059992_5 WHERE cfl_team = "Saskatchewan"
sql_create_context
CREATE TABLE table_72254 ( "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 season features writer Michael Poryes?
SELECT "Season #" FROM table_72254 WHERE "Written by" = 'Michael Poryes'
wikisql
CREATE TABLE table_name_67 ( frequency_mhz INTEGER, call_sign VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the sum of frequency will call sign of k259aw
SELECT SUM(frequency_mhz) FROM table_name_67 WHERE call_sign = "k259aw"
sql_create_context
CREATE TABLE table_name_81 ( operator VARCHAR, berths VARCHAR, depth__m_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the operator with berths more than 1 and depth of 12.5-15.5
SELECT operator FROM table_name_81 WHERE berths > 1 AND depth__m_ = "12.5-15.5"
sql_create_context
CREATE TABLE claim_headers ( claim_header_id number, claim_status_code text, claim_type_code text, policy_id number, date_of_claim time, date_of_settlement time, amount_claimed number, amount_piad number ) CREATE TABLE customers ( customer_id number, customer_details text ) CRE...
SELECT t2.claim_status_name FROM claims_processing AS t1 JOIN claims_processing_stages AS t2 ON t1.claim_stage_id = t2.claim_stage_id GROUP BY t1.claim_stage_id ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE table_train_135 ( "id" int, "loss_of_consciousness" bool, "systolic_blood_pressure_sbp" int, "head_injury" bool, "heart_disease" bool, "stroke" bool, "renal_disease" bool, "hepatic_disease" bool, "hydrocephalus" bool, "peptic_ulcer_disease" bool, "blood_glucose" ...
SELECT * FROM table_train_135 WHERE systolic_blood_pressure_sbp > 180 OR diastolic_blood_pressure_dbp > 100 OR myocardial_infarction = 1 OR heart_disease = 1 OR renal_disease = 1 OR hepatic_disease = 1 OR gastrointestinal_disease = 1 OR blood_glucose > 180
criteria2sql
CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, ins...
SELECT DISTINCT program_course.category FROM course, program_course WHERE course.department = 'RCSSCI' AND course.number = 396 AND program_course.course_id = course.course_id
advising
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 text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Government" AND demographic.admission_location = "EMERGENCY ROOM ADMIT"
mimicsql_data
CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Student ( StuID INTEGE...
SELECT dorm_name, COUNT(*) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.Age > 20 GROUP BY T3.dorm_name ORDER BY COUNT(*)
nvbench
CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, ...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND date_day.day_number = 22 AND date_day.month_number = 3 AN...
atis
CREATE TABLE table_name_94 ( draws VARCHAR, losses VARCHAR, club VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many draws did Mortlake have when the losses were more than 5?
SELECT COUNT(draws) FROM table_name_94 WHERE losses > 5 AND club = "mortlake"
sql_create_context
CREATE TABLE table_28505 ( "Week #" text, "Theme" text, "Song choice" text, "Original artist" text, "Order #" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many themes are there where the order # is 9?
SELECT COUNT("Theme") FROM table_28505 WHERE "Order #" = '9'
wikisql
CREATE TABLE table_204_328 ( id number, "no." number, "date" text, "tournament" text, "winning score" text, "margin of\nvictory" text, "runner(s)-up" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the first tournament listed ?
SELECT "tournament" FROM table_204_328 WHERE id = 1
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND procedures.short_title = "PTCA"
mimicsql_data
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "83" AND demographic.days_stay > "0"
mimicsql_data
CREATE TABLE table_name_47 ( incumbent VARCHAR, district VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Incumbent has a District of massachusetts 8?
SELECT incumbent FROM table_name_47 WHERE district = "massachusetts 8"
sql_create_context
CREATE TABLE fgwyjzb ( 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 gwyjzb.MED_ORG_DEPT_CD, gwyjzb.OUT_DIAG_DIS_CD, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '9480840' GROUP BY gwyjzb.MED_ORG_DEPT_CD, gwyjzb.OUT_DIAG_DIS_CD UNION SELECT fgwyjzb.MED_ORG_DEPT_CD, fgwyjzb.OUT_DIAG_DIS_CD, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '94...
css
CREATE TABLE ndecoreexcel_math_grade8 ( year number, state text, all_students text, average_scale_score number ) CREATE TABLE finrev_fed_17 ( state_code number, idcensus number, school_district text, nces_id text, yr_data number, t_fed_rev number, c14 number, c25 number ...
SELECT T2.state, T3.average_scale_score FROM finrev_fed_key_17 AS T2 JOIN finrev_fed_17 AS T1 ON T1.state_code = T2.state_code JOIN ndecoreexcel_math_grade8 AS T3 ON T2.state = T3.state GROUP BY T2.state ORDER BY SUM(T1.t_fed_rev) DESC LIMIT 1
studentmathscore
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE area ( course_id int, area varchar ) CREATE TAB...
SELECT DISTINCT name, number FROM course WHERE credits = 16 AND department = 'EECS'
advising
CREATE TABLE table_14889048_2 ( draws VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How may draws did libertad have?
SELECT COUNT(draws) FROM table_14889048_2 WHERE team = "Libertad"
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 t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.t_kc21_PERSON_NM = '水宏茂' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2008-01-30' AND '2008-06-28'
css
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.gender = "F" AND procedures.short_title = "Parent infus nutrit sub"
mimicsql_data
CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT ) CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT ) CREATE TABLE weather ( date TEXT, ...
SELECT date, COUNT(date) FROM weather WHERE max_temperature_f > 85 ORDER BY COUNT(date) DESC
nvbench
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid numb...
SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-98330' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi...
eicu
CREATE TABLE table_47843 ( "Tournament" text, "1998" text, "1999" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text, "2013" text...
SELECT "2010" FROM table_47843 WHERE "2006" = '3r'
wikisql
CREATE TABLE table_63028 ( "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 highest silver that has 57 as the total, with a bronze greater than 20?
SELECT MAX("Silver") FROM table_63028 WHERE "Total" = '57' AND "Bronze" > '20'
wikisql
CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Movie ( mID int, title text, year int, director text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Visua...
SELECT T2.title, SUM(MIN(T1.stars)) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T2.title
nvbench
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, value...
SELECT AVG(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13897)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admi...
mimic_iii
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicatio...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE NOT patient.hospitaldischargetime IS NULL AND STRFTIME('%y', patient.hospitaldischargetime) = '2101'
eicu
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, Dupli...
SELECT P.Id AS "post_link", P.Tags, P.CreationDate FROM Posts AS P WHERE P.AnswerCount > 0 AND P.Tags LIKE '%##Tag1##%' AND P.Tags LIKE '%##Tag2##%' ORDER BY P.CreationDate DESC LIMIT 50000
sede
CREATE TABLE journalist ( journalist_ID int, Name text, Nationality text, Age text, Years_working int ) CREATE TABLE news_report ( journalist_ID int, Event_ID int, Work_Type text ) CREATE TABLE event ( Event_ID int, Date text, Venue text, Name text, Event_Attendance...
SELECT Nationality, COUNT(*) FROM journalist GROUP BY Nationality ORDER BY COUNT(*)
nvbench
CREATE TABLE table_24649 ( "Year" real, "Starts" real, "Wins" real, "Top 5" real, "Top 10" real, "Poles" real, "Avg. Start" text, "Avg. Finish" text, "Winnings" text, "Position" text, "Team(s)" text ) -- Using valid SQLite, answer the following questions for the tables prov...
SELECT "Avg. Finish" FROM table_24649 WHERE "Winnings" = '$71,200'
wikisql
CREATE TABLE table_name_88 ( wsu_year_s_ VARCHAR, pro_year_s_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is WSU Year(s), when Pro Year(s) is 1974-77?
SELECT wsu_year_s_ FROM table_name_88 WHERE pro_year_s_ = "1974-77"
sql_create_context
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE ReviewTaskResults ( Id number, Review...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS Position, DisplayName, Reputation, WebsiteUrl, Location, WebsiteUrl, AboutMe, 'http://stackoverflow.com/users/' + CAST(Id AS TEXT(10)) AS ProfileUrl FROM Users WHERE UPPER(Location) LIKE '%NETHERLANDS%' OR UPPER(Location) LIKE '%NEDERLAND%' OR UPPER(Location) LIKE ...
sede
CREATE TABLE Customers_Cards ( card_id INTEGER, customer_id INTEGER, card_type_code VARCHAR(15), card_number VARCHAR(80), date_valid_from DATETIME, date_valid_to DATETIME, other_card_details VARCHAR(255) ) CREATE TABLE Customers ( customer_id INTEGER, customer_first_name VARCHAR(20)...
SELECT transaction_type, COUNT(*) FROM Financial_Transactions GROUP BY transaction_type ORDER BY transaction_type DESC
nvbench
CREATE TABLE table_204_373 ( id number, "wager" text, "winner" text, "loser" text, "location" text, "date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who is the first loser listed on this chart ?
SELECT "loser" FROM table_204_373 WHERE id = 1
squall