context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
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,
... | show me the number of patients whose lab test category is hematology. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab."CATEGORY" = "Hematology" | mimicsql_data |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions... | count the number of patients whose year of birth is less than 2120 and lab test fluid is other body fluid? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2120" AND lab.fluid = "Other Body Fluid" | mimicsql_data |
CREATE TABLE Products (
Product_ID INTEGER,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4)
)
CREATE TABLE Assets (
Asset_ID INTEGER,
Other_Details VARCHAR(255)
)
CREATE TABLE Addresses (
Address_ID INTEGER,
address_details VARCHAR(255)
)
CREATE TABL... | Show different type codes of products and the number of products with each type code Visualize by bar chart, sort in asc by the bars. | SELECT Product_Type_Code, COUNT(*) FROM Products GROUP BY Product_Type_Code ORDER BY Product_Type_Code | nvbench |
CREATE TABLE table_28853 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" text,
"Result" text,
"Candidates" text
) | Name the candidates for selah r. hobbie | SELECT "Candidates" FROM table_28853 WHERE "Incumbent" = 'Selah R. Hobbie' | wikisql |
CREATE TABLE table_name_9 (
season VARCHAR,
name VARCHAR
) | What years did Omar Sneed play? | SELECT season FROM table_name_9 WHERE name = "omar sneed" | sql_create_context |
CREATE TABLE table_name_15 (
latitude INTEGER,
pop__2010_ VARCHAR,
water__sqmi_ VARCHAR,
county VARCHAR
) | What is the average latitude for townships in Dickey county with water under 2.106 sqmi and population under 95? | SELECT AVG(latitude) FROM table_name_15 WHERE water__sqmi_ < 2.106 AND county = "dickey" AND pop__2010_ < 95 | sql_create_context |
CREATE TABLE table_name_41 (
enrollment INTEGER,
institution VARCHAR
) | What is the average Enrollment of Dickinson College? | SELECT AVG(enrollment) FROM table_name_41 WHERE institution = "dickinson college" | sql_create_context |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE vitalperiodic (
vitalperio... | how many patients had received a electrolyte administration - calcium procedure two times during the last year? | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, COUNT(*) AS c1 FROM patient WHERE patient.patientunitstayid = (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'electrolyte administration - calcium' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CU... | eicu |
CREATE TABLE table_50084 (
"Lane" real,
"Name" text,
"Country" text,
"Mark" text,
"React" real
) | What is Mark, when Lane is less than 5, and when React is 0.217? | SELECT "Mark" FROM table_50084 WHERE "Lane" < '5' AND "React" = '0.217' | wikisql |
CREATE TABLE table_name_94 (
games VARCHAR,
drawn VARCHAR,
lost VARCHAR
) | How many Games have a Drawn larger than 0, and a Lost of 1? | SELECT COUNT(games) FROM table_name_94 WHERE drawn > 0 AND lost = 1 | 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 diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions... | Specify the discharge time of patient Bessie Giordano along with his duration of hospital stay. | SELECT demographic.days_stay, demographic.dischtime FROM demographic WHERE demographic.name = "Bessie Giordano" | mimicsql_data |
CREATE TABLE county (
county_id number,
county_name text,
population number,
zip_code text
)
CREATE TABLE election (
election_id number,
counties_represented text,
district number,
delegate text,
party number,
first_elected number,
committee text
)
CREATE TABLE party (
... | Count the number of distinct delegates who are from counties with population above 50000. | SELECT COUNT(DISTINCT T2.delegate) FROM county AS T1 JOIN election AS T2 ON T1.county_id = T2.district WHERE T1.population > 50000 | spider |
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
HZXM text,
JZKSDM text,
JZKSMC text,
JZLSH text,
KH text,
KLX number,
MZBMLX number,
MZJZLSH text,
MZZDBM text,
MZZDMC text,
MZZYZDZZBM... | 叫王红豆的病人的上臂的各项指标检验的结果如何? | SELECT * FROM person_info JOIN hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jy... | css |
CREATE TABLE table_name_18 (
date VARCHAR,
round VARCHAR,
circuit VARCHAR
) | What is Date, when Round is less than 10, and when Circuit is 'Norisring'? | SELECT date FROM table_name_18 WHERE round < 10 AND circuit = "norisring" | sql_create_context |
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE departments (
DEP... | For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of hire_date and the sum of department_id bin hire_date by time, order in asc by the sum department id. | SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(DEPARTMENT_ID) | nvbench |
CREATE TABLE table_13014 (
"County" text,
"Per capita income" text,
"Median household income" text,
"Median family income" text,
"Population" real,
"Number of households" real
) | Which County has a Number of households larger than 14,391, a Population larger than 17,415, and a Median household income of $32,700? | SELECT "County" FROM table_13014 WHERE "Number of households" > '14,391' AND "Population" > '17,415' AND "Median household income" = '$32,700' | wikisql |
CREATE TABLE table_47141 (
"Rank" text,
"Team" text,
"Run 1" text,
"Run 2" text,
"Run 3" text,
"Run 4" text,
"Final" text
) | What was the run 1 for the team with a run 3 of 1:21.4 and a run 4 of 1:23.0? | SELECT "Run 1" FROM table_47141 WHERE "Run 3" = '1:21.4' AND "Run 4" = '1:23.0' | wikisql |
CREATE TABLE table_30250 (
"No." real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" real,
"U.S. viewers (million)" text
) | What is the name of the episode written by David Matthews? | SELECT "Title" FROM table_30250 WHERE "Written by" = 'David Matthews' | wikisql |
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImage... | Posts by tag per week. | SELECT WeekStart, COUNT(UniqueId) FROM (SELECT Posts.Id AS UniqueId, DATEADD(week, DATEDIFF(day, '20000109', CreationDate) / 7, '20000109') AS WeekStart FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.Id = PostTags.PostId WHERE Tags.TagName = @Tag AND Posts.PostTypeId = 1) AS Relevan... | sede |
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
) | Draw a bar chart for what is the average rating star for each reviewer?, sort y axis in desc order please. | SELECT name, AVG(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name ORDER BY AVG(T1.stars) DESC | nvbench |
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,
IsHidden boolean,
Predefined boolean,
PostNoticeDurationId number
)
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeI... | Posts closed, edited by users with <3k rep and reopened. | SELECT COUNT(i.PostId) FROM PostHistory AS i INNER JOIN PostHistory AS c ON i.PostId = c.PostId AND i.PostHistoryTypeId = 1 INNER JOIN PostHistory AS e ON c.PostId = e.PostId AND c.PostHistoryTypeId = 10 AND e.PostHistoryTypeId = 5 AND c.CreationDate < e.CreationDate AND i.UserId != e.UserId INNER JOIN Users AS u ON e.... | sede |
CREATE TABLE table_name_70 (
name VARCHAR,
opponent VARCHAR
) | When SSC-R is the opponent what is the name? | SELECT name FROM table_name_70 WHERE opponent = "ssc-r" | sql_create_context |
CREATE TABLE table_name_62 (
score VARCHAR,
home VARCHAR,
leading_scorer VARCHAR
) | Which score has a Home of grizzlies, and a Leading scorer of rudy gay (18)? | SELECT score FROM table_name_62 WHERE home = "grizzlies" AND leading_scorer = "rudy gay (18)" | sql_create_context |
CREATE TABLE table_26986076_1 (
mon_23_aug VARCHAR,
fri_27_aug VARCHAR
) | How many times was the time 19' 38.87 115.219mph on Fri Aug 27? | SELECT COUNT(mon_23_aug) FROM table_26986076_1 WHERE fri_27_aug = "19' 38.87 115.219mph" | sql_create_context |
CREATE TABLE table_42012 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
) | What is the Attendance for Opponent Boston Patriots and Week is greater than 14? | SELECT COUNT("Attendance") FROM table_42012 WHERE "Opponent" = 'boston patriots' AND "Week" > '14' | wikisql |
CREATE TABLE table_25220821_3 (
tues_1_june VARCHAR,
mon_31_may VARCHAR
) | What is the Tuesday 1 June total number if Monday 31 May is 20' 15.35 111.761mph? | SELECT COUNT(tues_1_june) FROM table_25220821_3 WHERE mon_31_may = "20' 15.35 111.761mph" | sql_create_context |
CREATE TABLE table_5947 (
"Week" text,
"Date" text,
"Opponent" text,
"Result" text,
"Kickoff" text,
"Game site" text,
"Record" text,
"Match Report" text
) | Which Match Report has a Date of october 26, 2008? | SELECT "Match Report" FROM table_5947 WHERE "Date" = 'october 26, 2008' | wikisql |
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
HZXM text,
JZKSDM text,
JZKSMC text,
JZLSH text,
KH text,
KLX number,
MZBMLX number,
MZJZLSH text,
MZZDBM text,
MZZDMC text,
MZZYZDZZBM... | 在2007-10-12到2017-03-18内患者范华池曾在医院有多少次就诊? | SELECT (SELECT COUNT(*) FROM person_info JOIN hz_info JOIN txmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX WHERE person_info.XM = '范华池' AND txmzjzjlb.JZKSRQ BETWEEN '2007-10-12' AND '2017-03-18' UNION SELECT COUNT(*) FROM p... | css |
CREATE TABLE weather (
date VARCHAR,
EVENTS VARCHAR,
zip_code VARCHAR
) | In zip code 94107, on which day neither Fog nor Rain was not observed? | SELECT date FROM weather WHERE zip_code = 94107 AND EVENTS <> "Fog" AND EVENTS <> "Rain" | sql_create_context |
CREATE TABLE table_16275828_4 (
location VARCHAR,
track_name VARCHAR
) | What location is farmer city speedway? | SELECT location FROM table_16275828_4 WHERE track_name = "Farmer City Speedway" | sql_create_context |
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location text,
insurance text,
language text,
marital_status text,
ethnicity text,
age number
)
CREATE ... | when has patient 18742 been given calculated total co2 test for the first time since 102 months ago? | SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'calculated total co2') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18742) AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_TI... | mimic_iii |
CREATE TABLE club (
club_id number,
club_name text,
region text,
start_year number
)
CREATE TABLE coach (
coach_id number,
coach_name text,
gender text,
club_id number,
rank number
)
CREATE TABLE player (
player_id number,
sponsor_name text,
player_name text,
gender... | Show the residences that have both a player of gender 'M' and a player of gender 'F'. | SELECT residence FROM player WHERE gender = "M" INTERSECT SELECT residence FROM player WHERE gender = "F" | spider |
CREATE TABLE table_name_21 (
record VARCHAR,
opponent VARCHAR
) | What is terry's record when he fights julio paulino? | SELECT record FROM table_name_21 WHERE opponent = "julio paulino" | sql_create_context |
CREATE TABLE table_67671 (
"Position" text,
"Player" text,
"County team" text,
"Club team(s)" text,
"Team Number" real
) | Which position has john keane as the player? | SELECT "Position" FROM table_67671 WHERE "Player" = 'john keane' | wikisql |
CREATE TABLE table_883 (
"Position" real,
"Artist" text,
"Song title" text,
"Highest position" real,
"Points" real
) | what is the minimum highest position with artbeingt being paul evans | SELECT MIN("Highest position") FROM table_883 WHERE "Artist" = 'Paul Evans' | wikisql |
CREATE TABLE table_22128871_1 (
result VARCHAR,
year__ceremony_ VARCHAR
) | What is every result for the ceremony year of 2007 (80th)? | SELECT result FROM table_22128871_1 WHERE year__ceremony_ = "2007 (80th)" | sql_create_context |
CREATE TABLE table_name_99 (
delegate VARCHAR,
first_elected VARCHAR
) | When first elected was 2006, who was the delegate? | SELECT delegate FROM table_name_99 WHERE first_elected = 2006 | sql_create_context |
CREATE TABLE table_name_26 (
total VARCHAR,
years VARCHAR
) | What is the Total for 1953 1964? | SELECT total FROM table_name_26 WHERE years = "1953–1964" | sql_create_context |
CREATE TABLE table_name_48 (
position VARCHAR,
year VARCHAR,
competition VARCHAR
) | In which position did Ilju t enko finish in the European Championships held prior to 2008? | SELECT position FROM table_name_48 WHERE year < 2008 AND competition = "european championships" | sql_create_context |
CREATE TABLE table_200_38 (
id number,
"new municipality" text,
"old municipalities" text,
"seat" text
) | what is the new municipality of tyros ? | SELECT "new municipality" FROM table_200_38 WHERE "old municipalities" = 'tyros' | squall |
CREATE TABLE table_24592 (
"Year" real,
"Date" text,
"Driver" text,
"Team" text,
"Manufacturer" text,
"Laps" text,
"Miles (km)" text,
"Race Time" text,
"Average Speed (mph)" text,
"Report" text
) | How many drivers drove 300 laps at average speed of 103.594? | SELECT COUNT("Driver") FROM table_24592 WHERE "Laps" = '300' AND "Average Speed (mph)" = '103.594' | wikisql |
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CRE... | Posts by a user ordered by number of links they contain. | SELECT Posts.Id AS "post_link", (LENGTH(Posts.Body) - LENGTH(REPLACE(Posts.Body, 'https://' + LOWER(RIGHT(DB_NAME(DB_ID()), LENGTH(DB_NAME(DB_ID())) - STR_POSITION(DB_NAME(DB_ID()), '.'))), ''))) / 14 + (LENGTH(Posts.Body) - LENGTH(REPLACE(Posts.Body, 'http://' + LOWER(RIGHT(DB_NAME(DB_ID()), LENGTH(DB_NAME(DB_ID())) -... | sede |
CREATE TABLE table_name_97 (
club_team VARCHAR,
player VARCHAR,
overall VARCHAR,
round VARCHAR
) | What Club team has an average of 8, plays kaj linna, and has an overall larger than 131? | SELECT club_team FROM table_name_97 WHERE overall > 131 AND round = 8 AND player = "kaj linna" | sql_create_context |
CREATE TABLE table_28628309_6 (
totals VARCHAR,
average VARCHAR
) | What were the totals when the average is 6.25? | SELECT totals FROM table_28628309_6 WHERE average = "6.25" | sql_create_context |
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TA... | How many users are there in StackOverflow?. | SELECT COUNT(DISTINCT Id) AS Users FROM Users | sede |
CREATE TABLE table_233830_1 (
horizontal_order VARCHAR,
channels VARCHAR
) | If the channels is wxyzrstuvpq, what is the horizontal order? | SELECT horizontal_order FROM table_233830_1 WHERE channels = "WXYZRSTUVPQ" | sql_create_context |
CREATE TABLE table_17200372_2 (
going_to VARCHAR,
calling_at VARCHAR,
departure VARCHAR
) | Name the number of going to for thurlby, braceborough spa at departure being 16.50 | SELECT COUNT(going_to) FROM table_17200372_2 WHERE calling_at = "Thurlby, Braceborough Spa" AND departure = "16.50" | sql_create_context |
CREATE TABLE table_name_78 (
lost INTEGER,
drawn VARCHAR,
played VARCHAR
) | How much Lost has a Drawn larger than 5, and a Played larger than 18? | SELECT SUM(lost) FROM table_name_78 WHERE drawn > 5 AND played > 18 | sql_create_context |
CREATE TABLE table_name_48 (
player VARCHAR,
country VARCHAR,
total VARCHAR
) | What is Player, when Country is 'United States', and when Total is '154'? | SELECT player FROM table_name_48 WHERE country = "united states" AND total = "154" | sql_create_context |
CREATE TABLE table_27904 (
"Urban settlement" text,
"Cyrillic Name" text,
"City / municipality" text,
"District" text,
"Population (1991)" real,
"Population (2002)" real,
"Population (2011)" real
) | What is the population (1991) when cyrillic name is ? | SELECT MIN("Population (1991)") FROM table_27904 WHERE "Cyrillic Name" = 'Панчево' | wikisql |
CREATE TABLE table_name_65 (
year INTEGER,
income VARCHAR,
expenditure VARCHAR,
_percentage_gdp VARCHAR
) | Which Year has an Expenditure smaller than 41.3, and a % GDP of x, and an Income larger than 34.4? | SELECT SUM(year) FROM table_name_65 WHERE expenditure < 41.3 AND _percentage_gdp = "x" AND income > 34.4 | sql_create_context |
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE T... | Top users by offered bounties in 2017. | SELECT ROW_NUMBER() OVER (ORDER BY SUM(Votes.BountyAmount) DESC, Users.Id) AS rnSum, ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC, Users.Id) AS rnCount, Users.Id, Users.DisplayName, Users.Reputation, SUM(Votes.BountyAmount) AS BountyOfferedTotal, COUNT(*) AS BountyOfferedCount FROM Votes INNER JOIN Posts ON Posts.Id = Vot... | sede |
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... | 有多少门诊手术费是在2016年10月30日到2018年3月13日期间参保人00614824交付的? | SELECT SUM(t_kc22.AMOUNT) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_ID = '00614824' AND t_kc21.CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2016-10-30' AND '2018-03-13' AND t_kc22.MED_INV_ITEM_TYPE = '手术费' | css |
CREATE TABLE table_name_46 (
season VARCHAR,
champion VARCHAR
) | Which season was Manresa the champion? | SELECT season FROM table_name_46 WHERE champion = "manresa" | sql_create_context |
CREATE TABLE college (
cname text,
state text,
enr number
)
CREATE TABLE tryout (
pid number,
cname text,
ppos text,
decision text
)
CREATE TABLE player (
pid number,
pname text,
ycard text,
hs number
) | What are the different states that had students successfully try out? | SELECT DISTINCT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cname = T2.cname WHERE T2.decision = 'yes' | spider |
CREATE TABLE table_27594 (
"June 10-11" text,
"March 27-29" text,
"January 15-16" text,
"November 3" text,
"August 21-22" text
) | june 10-11 when january 15-16 is january 15, 1991? | SELECT "June 10-11" FROM table_27594 WHERE "January 15-16" = 'January 15, 1991' | wikisql |
CREATE TABLE people (
People_ID int,
District text,
Name text,
Party text,
Age int
)
CREATE TABLE debate (
Debate_ID int,
Date text,
Venue text,
Num_of_Audience int
)
CREATE TABLE debate_people (
Debate_ID int,
Affirmative int,
Negative int,
If_Affirmative_Win bool
... | Show different parties of people along with the number of people in each party with a bar chart, order total number in descending order. | SELECT Party, COUNT(*) FROM people GROUP BY Party ORDER BY COUNT(*) DESC | nvbench |
CREATE TABLE table_14154271_2 (
results VARCHAR,
gt2_winning_team VARCHAR
) | The results for gt2 winning team is all lars-erik nielsen allan simonsen richard westbrook. | SELECT results FROM table_14154271_2 WHERE gt2_winning_team = "Lars-Erik Nielsen Allan Simonsen Richard Westbrook" | sql_create_context |
CREATE TABLE table_name_1 (
listed VARCHAR,
built VARCHAR,
type VARCHAR
) | What is the listed date of the Warren pony truss bridge that was built in 1925? | SELECT listed FROM table_name_1 WHERE built = "1925" AND type = "warren pony truss" | sql_create_context |
CREATE TABLE reviewer (
rid number,
name text
)
CREATE TABLE rating (
rid number,
mid number,
stars number,
ratingdate time
)
CREATE TABLE movie (
mid number,
title text,
year number,
director text
) | For each director who directed more than one movie, what are the titles and dates of release for all those movies? | SELECT T1.title, T1.year FROM movie AS T1 JOIN movie AS T2 ON T1.director = T2.director WHERE T1.title <> T2.title | spider |
CREATE TABLE table_203_349 (
id number,
"no. in\nseries" number,
"no. in\nseason" number,
"title" text,
"directed by" text,
"written by" text,
"original air date" text,
"production\ncode" text,
"u.s. viewers\n(millions)" number
) | which episode had a higher number of viewers , identity or dead drop ? | SELECT "title" FROM table_203_349 WHERE "title" IN ('"identity"', '"dead drop"') ORDER BY "u.s. viewers\n(millions)" DESC LIMIT 1 | squall |
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
OwnerUserId number,
Comment text,
Text ... | cliffer some closed questions that need cliffering. http://meta.stackexchange.com/questions/78048/enable-automatic-deletion-of-old-unanswered-zero-score-questions-after-a-year/92006#92006 | SELECT q.Id AS "post_link", q.Score AS qScore, a.Score AS aScore, q.ViewCount AS Views, q.CreationDate AS qDate FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id WHERE q.PostTypeId = 1 AND a.PostTypeId = 2 AND q.AnswerCount = '##numOfAnswers?1##' AND q.Score < 1 AND a.Score = 1 AND LEN(a.Body) < '##lengthOfAns... | sede |
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
)
... | count the number of patients taking drug via pr route who have other and unspecified alcohol dependence, unspecified diagnoses. | 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.long_title = "Other and unspecified alcohol dependence, unspecified" AND prescriptions.route = "PR" | mimicsql_data |
CREATE TABLE Allergy_Type (
Allergy VARCHAR(20),
AllergyType VARCHAR(20)
)
CREATE TABLE Has_Allergy (
StuID INTEGER,
Allergy VARCHAR(20)
)
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER... | A bar chart about the number of last name for all female students whose sex is F, could you sort in descending by the X? | SELECT LName, COUNT(LName) FROM Student WHERE Sex = 'F' GROUP BY LName ORDER BY LName DESC | nvbench |
CREATE TABLE table_28768925_1 (
written_by VARCHAR,
directed_by VARCHAR,
no_in_series VARCHAR
) | Who wrote episode 27 in the series that was directed by Wendey Stanzler? | SELECT written_by FROM table_28768925_1 WHERE directed_by = "Wendey Stanzler" AND no_in_series = 27 | sql_create_context |
CREATE TABLE table_name_36 (
division INTEGER,
year VARCHAR,
reg_season VARCHAR,
playoffs VARCHAR
) | Which Division that has a Reg Season of 1st, western, and Playoffs of champions, and a Year smaller than 2013? | SELECT AVG(division) FROM table_name_36 WHERE reg_season = "1st, western" AND playoffs = "champions" AND year < 2013 | sql_create_context |
CREATE TABLE county (
County_Id int,
County_name text,
Population real,
Zip_code text
)
CREATE TABLE party (
Party_ID int,
Year real,
Party text,
Governor text,
Lieutenant_Governor text,
Comptroller text,
Attorney_General text,
US_Senate text
)
CREATE TABLE election (
... | Show me population by county name in a histogram, list by the Population in asc. | SELECT County_name, Population FROM county ORDER BY Population | nvbench |
CREATE TABLE table_9123 (
"Season" real,
"Premiered" text,
"Bachelor" text,
"Winner" text,
"Runner(s)-Up" text,
"Proposal" text
) | Who was the runner-up for the show that premiered on March 25, 2002? | SELECT "Runner(s)-Up" FROM table_9123 WHERE "Premiered" = 'march 25, 2002' | wikisql |
CREATE TABLE table_67853 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" real,
"Record" text
) | What was the attendance on August 23? | SELECT COUNT("Attendance") FROM table_67853 WHERE "Date" = 'august 23' | 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,... | 都是什么编号的医疗记录上显示了王霞英这个病人吃的药的价格都高于689.98元的? | SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_NM = '王霞英' AND NOT MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc22 WHERE AMOUNT <= 689.98) | css |
CREATE TABLE table_15882 (
"Year" real,
"Tournaments played" real,
"Cuts made*" real,
"Wins" real,
"2nd" real,
"Top 10s" real,
"Best finish" text,
"Earnings ($)" real,
"Money list rank" text,
"Scoring average" text,
"Scoring rank" text
) | How many wins were there when the money list rank was 183? | SELECT COUNT("Wins") FROM table_15882 WHERE "Money list rank" = '183' | wikisql |
CREATE TABLE bank (
branch_ID int,
bname varchar(20),
no_of_customers int,
city varchar(10),
state varchar(20)
)
CREATE TABLE loan (
loan_ID varchar(3),
loan_type varchar(15),
cust_ID varchar(3),
branch_ID varchar(3),
amount int
)
CREATE TABLE customer (
cust_ID varchar(3),... | What are the names and account balances of customers with the letter a in their names. Show the proportion. | SELECT cust_name, acc_bal FROM customer WHERE cust_name LIKE '%a%' | nvbench |
CREATE TABLE table_name_67 (
opponent VARCHAR,
winner VARCHAR
) | Tell me the opponent for winner of bc 2 | SELECT opponent FROM table_name_67 WHERE winner = "bc 2" | sql_create_context |
CREATE TABLE table_69885 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Time" text,
"Att." real,
"Record" text
) | Which record has 2:57 as the time? | SELECT "Record" FROM table_69885 WHERE "Time" = '2:57' | wikisql |
CREATE TABLE table_204_465 (
id number,
"#" number,
"temple name" text,
"hangul" text,
"hanja" text,
"period of reign" text,
"personal name" text,
"relationship" text,
"note" text
) | what is the top temple name listed that also has a personal name listed ? | SELECT "temple name" FROM table_204_465 WHERE NOT "personal name" IS NULL ORDER BY id LIMIT 1 | squall |
CREATE TABLE table_33861 (
"Pos." real,
"Mark" text,
"Athlete" text,
"Venue" text,
"Date" text
) | Which athlete played at the Birmingham venue? | SELECT "Athlete" FROM table_33861 WHERE "Venue" = 'birmingham' | wikisql |
CREATE TABLE table_name_12 (
host VARCHAR,
venue VARCHAR
) | What was the host of the round at Hammons Student Center? | SELECT host FROM table_name_12 WHERE venue = "hammons student center" | sql_create_context |
CREATE TABLE table_68648 (
"Club" text,
"City or town" text,
"Position in 2012\u201313 season" text,
"First season in top division" text,
"Number of seasons in top division" real,
"First season of current spell in top division" text,
"Top division titles" text,
"Last top division title" ... | Which City or town has a Top division titles of 17 | SELECT "City or town" FROM table_68648 WHERE "Top division titles" = '17' | wikisql |
CREATE TABLE bdmzjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
HZXM text,
JZKSDM text,
JZKSMC text,
JZLSH number,
KH text,
KLX number,
MZBMLX number,
MZJZLSH text,
MZZDBM text,
MZZDMC text,
MZZYZD... | 查下患者80143781去医院9437300就诊的记录中出院时出院科室的名字和甲状腺无关的住院就诊记录 | SELECT * FROM hz_info JOIN wdmzjzjlb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE hz_info.RYBH = '80143781' AND hz_info.YLJGDM = '9437300' AND NOT wdmzjzjlb.CYKSMC LIKE '%甲状腺%' UNION SELECT * FROM hz_info JOIN bdmzjzjlb ON hz_info.YLJGDM = bdmzjzjlb.YLJGDM AND... | css |
CREATE TABLE table_34361 (
"Surname" text,
"First" text,
"D.O.B." text,
"Uni#" real,
"Bats" text,
"Throws" text,
"Position" text
) | What is Marc's Surname? | SELECT "Surname" FROM table_34361 WHERE "First" = 'marc' | wikisql |
CREATE TABLE table_name_46 (
byes INTEGER,
losses VARCHAR,
against VARCHAR
) | What is the average Byes for the losses of 15, and before 1874? | SELECT AVG(byes) FROM table_name_46 WHERE losses = 15 AND against < 1874 | sql_create_context |
CREATE TABLE table_name_11 (
fourth_place VARCHAR,
year VARCHAR
) | What is the Fourth place with a Year that is 1966? | SELECT fourth_place FROM table_name_11 WHERE year = 1966 | sql_create_context |
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... | how many days is it since patient 006-133605 last had a procedure on this hospital encounter? | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-133605... | eicu |
CREATE TABLE table_70446 (
"Team" text,
"Manager 1" text,
"Captain" text,
"Kit manufacturer" text,
"Shirt sponsor" text
) | What team has Pony as the kit manufacturer and Gary Mabbutt as the captain? | SELECT "Team" FROM table_70446 WHERE "Kit manufacturer" = 'pony' AND "Captain" = 'gary mabbutt' | wikisql |
CREATE TABLE coach (
Coach_ID int,
Coach_name text,
Gender text,
Club_ID int,
Rank int
)
CREATE TABLE player (
Player_ID int,
Sponsor_name text,
Player_name text,
Gender text,
Residence text,
Occupation text,
Votes int,
Rank text
)
CREATE TABLE match_result (
Ra... | For players whose occupation is not 'Researcher', tell me the proportion of their residences with a pie chart. | SELECT Residence, COUNT(Residence) FROM player WHERE Occupation <> "Researcher" GROUP BY Residence | nvbench |
CREATE TABLE table_77793 (
"Goal" real,
"Date" text,
"Venue" text,
"Result" text,
"Competition" text
) | At the venue of panama city, on 11 Febrero 2006, how many goals were scored? | SELECT COUNT("Goal") FROM table_77793 WHERE "Venue" = 'panama city' AND "Date" = '11 febrero 2006' | wikisql |
CREATE TABLE table_name_26 (
game INTEGER,
team VARCHAR
) | What was the latest game that Sacramento played? | SELECT MAX(game) FROM table_name_26 WHERE team = "sacramento" | sql_create_context |
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREATE TABLE city (
city_code varchar,
city_name varchar,
state_code varchar,
country_name varchar,
time_zone_code varchar
)
... | list all nonstop flights from LOS ANGELES to PITTSBURGH before 1700 on tuesday | 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 (((date_day.day_number = 22 AND date_day.month_number = 3 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_tim... | atis |
CREATE TABLE table_name_95 (
attendance INTEGER,
record VARCHAR
) | What was the lowest attendance at the game with a record of 50-36? | SELECT MIN(attendance) FROM table_name_95 WHERE record = "50-36" | sql_create_context |
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE airport (
airport_code varchar,
airport_name text,
airport_location text,
state_cod... | and what is the last flight from DENVER to BOSTON for tomorrow evening | 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 = 'BOSTON' AND date_day.day_number = 20 AND date_day.month_number = 1 AND ... | atis |
CREATE TABLE table_203_115 (
id number,
"name of place" text,
"counties" number,
"principal county" text,
"lower zip code" number
) | which county is listed above calciana ? | SELECT "name of place" FROM table_203_115 WHERE id = (SELECT id FROM table_203_115 WHERE "name of place" = 'calciana') - 1 | squall |
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... | Count the number of patients who were prescribed a base drug type and stayed in the hospital for more than 11 days. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "11" AND prescriptions.drug_type = "BASE" | mimicsql_data |
CREATE TABLE table_17355628_7 (
high_assists VARCHAR,
high_points VARCHAR
) | Who did the High Assists when Kevin Durant (28) took the High Points? | SELECT high_assists FROM table_17355628_7 WHERE high_points = "Kevin Durant (28)" | sql_create_context |
CREATE TABLE table_name_24 (
offer_team VARCHAR,
date VARCHAR
) | What Offer Team has a date of July 29, 1994? | SELECT offer_team FROM table_name_24 WHERE date = "july 29, 1994" | sql_create_context |
CREATE TABLE table_name_43 (
attendance VARCHAR,
tie_no VARCHAR
) | Which attendance has 9 as the tie no.? | SELECT attendance FROM table_name_43 WHERE tie_no = 9 | sql_create_context |
CREATE TABLE table_33054 (
"Season" real,
"Division" real,
"Tms." real,
"Pos." real,
"FA Cup" text
) | What is the division in the season more recent than 2012 when the round of 16 was reached in the FA Cup? | SELECT COUNT("Division") FROM table_33054 WHERE "FA Cup" = 'round of 16' AND "Season" > '2012' | wikisql |
CREATE TABLE table_60761 (
"Official Name" text,
"Status" text,
"Area km 2" real,
"Population" real,
"Census Ranking" text
) | What is the name of the place that has a census ranking of 1,229 of 5,008? | SELECT "Official Name" FROM table_60761 WHERE "Census Ranking" = '1,229 of 5,008' | wikisql |
CREATE TABLE table_name_91 (
circuit VARCHAR,
fastest_lap VARCHAR,
pole_position VARCHAR
) | On which circuit does lorenzo bandini have the fastest lap as well as the pole position? | SELECT circuit FROM table_name_91 WHERE fastest_lap = "lorenzo bandini" AND pole_position = "lorenzo bandini" | sql_create_context |
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CRE... | Off topic questions in after 2015-1-1. | SELECT p.Id FROM Posts AS p INNER JOIN PostHistory AS ph ON p.Id = ph.PostId WHERE p.PostTypeId = 1 AND p.ClosedDate = ph.CreationDate AND ph.PostHistoryTypeId = 10 AND (Comment = 102) AND p.ClosedDate > '2015-1-1' | sede |
CREATE TABLE game (
stadium_id int,
id int,
Season int,
Date text,
Home_team text,
Away_team text,
Score text,
Competition text
)
CREATE TABLE stadium (
id int,
name text,
Home_Games int,
Average_Attendance real,
Total_Attendance real,
Capacity_Percentage real
)
... | List the number of games in each season and group by away team in a group line chart. | SELECT Season, COUNT(Season) FROM game GROUP BY Away_team, Season | nvbench |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.