context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
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... | provide the number of patients whose admission type is emergency and year of birth is less than 2197? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.dob_year < "2197" | mimicsql_data |
CREATE TABLE invoice_items (
invoice_item_id number,
invoice_id number,
order_id number,
order_item_id number,
product_id number,
order_quantity number,
other_item_details text
)
CREATE TABLE bookings_services (
order_id number,
product_id number
)
CREATE TABLE addresses (
addr... | Show all the planned delivery dates and actual delivery dates of bookings. | SELECT planned_delivery_date, actual_delivery_date FROM bookings | spider |
CREATE TABLE table_name_65 (
game VARCHAR,
record VARCHAR
) | What game has a 6-12-8 record? | SELECT game FROM table_name_65 WHERE record = "6-12-8" | sql_create_context |
CREATE TABLE railway (
Builder VARCHAR,
Railway_ID VARCHAR
)
CREATE TABLE train (
Railway_ID VARCHAR,
Name VARCHAR
) | Show the builder of railways associated with the trains named 'Andaman Exp'. | SELECT T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID WHERE T2.Name = "Andaman Exp" | sql_create_context |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,... | what is the number of patients whose death status is 1 and drug code is ns100cg? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.expire_flag = "1" AND prescriptions.formulary_drug_cd = "NS100CG" | mimicsql_data |
CREATE TABLE table_33067 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | How big was the crowd when Geelong was the home team? | SELECT COUNT("Crowd") FROM table_33067 WHERE "Home team" = 'geelong' | wikisql |
CREATE TABLE table_76144 (
"Title" text,
"Season" text,
"Winner" text,
"Score" text,
"Runner-up" text,
"Venue" text,
"Attendance" text
) | What is the Title when the winner was suntory sungoliath, and a Season of 2011-12 details? | SELECT "Title" FROM table_76144 WHERE "Winner" = 'suntory sungoliath' AND "Season" = '2011-12 details' | wikisql |
CREATE TABLE table_name_21 (
host_team VARCHAR,
stadium VARCHAR,
final_score VARCHAR
) | Who was the host team at Louisiana Superdome when the final score was 10-20? | SELECT host_team FROM table_name_21 WHERE stadium = "louisiana superdome" AND final_score = "10-20" | 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... | Show average of budget in each year and bin creation time by year in a line chart, order by the x-axis in ascending. | SELECT Creation, AVG(Budget_in_Billions) FROM department ORDER BY Creation | nvbench |
CREATE TABLE table_78486 (
"Driver" text,
"Constructor" text,
"Laps" text,
"Time/Retired" text,
"Grid" text
) | What's the time/retired for a grid of 14? | SELECT "Time/Retired" FROM table_78486 WHERE "Grid" = '14' | 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... | Among patients to whom drug was administered in both eyes, how many of them were born before the year 2170. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2170" AND prescriptions.route = "BOTH EYES" | mimicsql_data |
CREATE TABLE table_25252080_3 (
november_3 VARCHAR,
january_15_16 VARCHAR
) | What number is shown for november 3 where january 15-16 is 151? | SELECT november_3 FROM table_25252080_3 WHERE january_15_16 = "151" | sql_create_context |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | Find tags with no excerpt. | SELECT t.Id, t.TagName, t.Count FROM Posts AS p, Tags AS t WHERE p.PostTypeId = 4 AND LENGTH(p.Body) = 0 AND p.Id = t.ExcerptPostId ORDER BY t.Count DESC | sede |
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
... | Amount of user grouped by hundreds of their questions. | SELECT ((userQuestions.QuestionCount / 100) * 100) AS "questions_count", COUNT(UserQuestions.userId) AS "users_count" FROM (SELECT soUser.Id AS userId, COUNT(post.Id) AS QuestionCount FROM Posts AS post INNER JOIN Users AS soUser ON soUser.Id = post.OwnerUserId WHERE post.PostTypeId = 1 GROUP BY soUser.Id) AS userQuest... | sede |
CREATE TABLE station (
id INTEGER,
name TEXT,
lat NUMERIC,
long NUMERIC,
dock_count INTEGER,
city TEXT,
installation_date TEXT
)
CREATE TABLE weather (
date TEXT,
max_temperature_f INTEGER,
mean_temperature_f INTEGER,
min_temperature_f INTEGER,
max_dew_point_f INTEGER,
... | Bar chart x axis date y axis total number of cloud cover, and sort by the total number of cloud cover in ascending please. | SELECT date, SUM(cloud_cover) FROM weather ORDER BY SUM(cloud_cover) | nvbench |
CREATE TABLE table_name_19 (
fleet_numbers VARCHAR,
type VARCHAR
) | What are the fleet number for the 4-6-4t locomotive? | SELECT fleet_numbers FROM table_name_19 WHERE type = "4-6-4t" | sql_create_context |
CREATE TABLE university (
School_ID int,
School text,
Location text,
Founded real,
Affiliation text,
Enrollment real,
Nickname text,
Primary_conference text
)
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Per... | Show me about the distribution of Team_Name and ACC_Percent in a bar chart, and show by the Y-axis in desc. | SELECT Team_Name, ACC_Percent FROM basketball_match ORDER BY ACC_Percent DESC | nvbench |
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 TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
... | when was patient 4900's arterial bp mean last measured less than 108.0 until 12/26/2105? | SELECT chartevents.charttime 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 = 4900)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial ... | mimic_iii |
CREATE TABLE aircraft (
aid number,
name text,
distance number
)
CREATE TABLE flight (
flno number,
origin text,
destination text,
distance number,
departure_date time,
arrival_date time,
price number,
aid number
)
CREATE TABLE certificate (
eid number,
aid number
)... | How many employees do we have? | SELECT COUNT(*) FROM employee | spider |
CREATE TABLE table_name_76 (
country VARCHAR,
score VARCHAR
) | Which country has a score of 70-71-72=213? | SELECT country FROM table_name_76 WHERE score = 70 - 71 - 72 = 213 | sql_create_context |
CREATE TABLE table_35782 (
"Rank" real,
"Airport" text,
"Metropolitan area" text,
"Passengers" real,
"Carriers" text
) | Which Metropolitan area has Passengers larger than 130,903, and a Rank of 4? | SELECT "Metropolitan area" FROM table_35782 WHERE "Passengers" > '130,903' AND "Rank" = '4' | wikisql |
CREATE TABLE table_204_822 (
id number,
"rank" number,
"nation" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
) | what nation received 6 gold medals other than bulgaria | SELECT "nation" FROM table_204_822 WHERE "gold" = 6 AND "nation" <> 'bulgaria' | squall |
CREATE TABLE table_17309500_1 (
steals VARCHAR,
season VARCHAR
) | Name the steals for season 2007/2008 | SELECT steals FROM table_17309500_1 WHERE season = "2007/2008" | sql_create_context |
CREATE TABLE table_8455 (
"Player" text,
"Team" text,
"Matches" real,
"Wickets" real,
"Average" real,
"Best Bowling" text
) | what is the highest wickets when the best bowling is 2/32 and matches is less than 5? | SELECT MAX("Wickets") FROM table_8455 WHERE "Best Bowling" = '2/32' AND "Matches" < '5' | wikisql |
CREATE TABLE table_name_45 (
pick__number VARCHAR,
player VARCHAR
) | What is the Pick # for brent meeke? | SELECT pick__number FROM table_name_45 WHERE player = "brent meeke" | sql_create_context |
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text... | what is the maximum total hospital cost that includes the carcinoembyronic antigen (cea) lab test until 1 year ago? | 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 = 'carcinoembyronic antigen (cea)')) AND DATETIME(cost.chargetime) <= DATETIME(CURRENT_TIME(), '-1 year'... | mimic_iii |
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE... | Count questions without accepted answer marked per tag count. | SELECT x.total, COUNT(x.Id), CAST(COUNT(x.Id) AS FLOAT) / (SELECT COUNT(Q.Id) FROM Posts AS Q WHERE Q.AnswerCount > 0 AND Q.PostTypeId = 1 AND Q.AcceptedAnswerId IS NULL) FROM (SELECT Q.Id, COUNT(PT.TagId) AS total FROM Posts AS Q INNER JOIN PostTags AS PT ON Q.Id = PT.PostId WHERE Q.AnswerCount > 0 AND Q.PostTypeId = ... | sede |
CREATE TABLE table_name_51 (
operation_start VARCHAR,
construction_start VARCHAR
) | Construction start of phase ii has what operation start? | SELECT operation_start FROM table_name_51 WHERE construction_start = "phase ii" | sql_create_context |
CREATE TABLE table_54027 (
"Date" text,
"Opponents" text,
"H / A" text,
"Result F\u2013A" text,
"Attendance" real,
"Group position" text
) | Which Group position has Result F A of 0 1 on 1 november 2006? | SELECT "Group position" FROM table_54027 WHERE "Result F\u2013A" = '0–1' AND "Date" = '1 november 2006' | wikisql |
CREATE TABLE Rating (
rID int,
mID int,
stars int,
ratingDate date
)
CREATE TABLE Movie (
mID int,
title text,
year int,
director text
)
CREATE TABLE Reviewer (
rID int,
name text
) | What are the titles of all movies that have rating star is between 3 and 5, and count them by a bar chart, and I want to show by the y axis in asc. | SELECT title, COUNT(title) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars BETWEEN 3 AND 5 GROUP BY title ORDER BY COUNT(title) | nvbench |
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,
... | 从2010年5月27日到2021年2月21日,医疗机构3892472有多少公务员有医疗就诊记录? | SELECT COUNT(*) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '3892472' AND gwyjzb.IN_HOSP_DATE BETWEEN '2010-05-27' AND '2021-02-21' | css |
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... | provide the number of patients whose ethnicity is asian and admission year is less than 2111? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "ASIAN" AND demographic.admityear < "2111" | mimicsql_data |
CREATE TABLE table_name_69 (
opponent VARCHAR,
record VARCHAR
) | Who was the opponent at the game when the record was 4-5? | SELECT opponent FROM table_name_69 WHERE record = "4-5" | sql_create_context |
CREATE TABLE table_2668405_17 (
first_elected VARCHAR,
candidates VARCHAR
) | How many times were the candidates leven powell (f) 63.8% roger west (dr) 36.4%? | SELECT COUNT(first_elected) FROM table_2668405_17 WHERE candidates = "Leven Powell (F) 63.8% Roger West (DR) 36.4%" | sql_create_context |
CREATE TABLE table_name_20 (
highest INTEGER,
average VARCHAR,
capacity VARCHAR
) | What's the highest with a capacity of greater than 4,000 and an average of 615? | SELECT MAX(highest) FROM table_name_20 WHERE average = 615 AND capacity > 4 OFFSET 000 | sql_create_context |
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 microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,... | compared to last measured on the last hospital visit, was the value of the hematocrit from patient 13686 less than the value first measured on the last hospital visit? | SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13686 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.l... | mimic_iii |
CREATE TABLE table_204_180 (
id number,
"date" text,
"opponent#" text,
"rank#" text,
"site" text,
"result" text,
"attendance" number
) | what was the point difference of the october 10th game ? | SELECT ABS("result" - "result") FROM table_204_180 WHERE "date" = 'october 10' | squall |
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_Employees real
)
CREATE TABLE head (
head_ID int,
name text,
born_state tex... | Show me a line chart of how the number of creation change over the creation, sort by the Creation in descending. | SELECT Creation, COUNT(Creation) FROM department ORDER BY Creation DESC | nvbench |
CREATE TABLE table_50044 (
"Episode" text,
"Rating" real,
"Share" real,
"Viewers (millions)" real,
"Weekly Rank" text
) | Which Episode has a Viewers (millions) larger than 11.26, a Weekly Rank of #8, and a Share of 12? | SELECT "Episode" FROM table_50044 WHERE "Viewers (millions)" > '11.26' AND "Weekly Rank" = '#8' AND "Share" = '12' | wikisql |
CREATE TABLE table_49140 (
"E. coli" text,
"Yeast (S. cerevisiae)" text,
"Human" text,
"Type" text,
"Substrates" text
) | What is the type of glycosylase that has an E. coli of Muty? | SELECT "Type" FROM table_49140 WHERE "E. coli" = 'muty' | 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... | what is drug name of drug code piog15? | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.formulary_drug_cd = "PIOG15" | mimicsql_data |
CREATE TABLE table_name_7 (
goals INTEGER,
player VARCHAR,
games VARCHAR
) | Which Goals have a Player of david mcllwain, and Games larger than 52? | SELECT MAX(goals) FROM table_name_7 WHERE player = "david mcllwain" AND games > 52 | 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 demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | Provide me the number of patients diagnosed with hypoxemia who had a blood test done. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Hypoxemia" AND lab.fluid = "Blood" | mimicsql_data |
CREATE TABLE table_name_41 (
laps INTEGER,
points VARCHAR
) | What is the highest number of laps for the driver with 5 points? | SELECT MAX(laps) FROM table_name_41 WHERE points = "5" | sql_create_context |
CREATE TABLE table_name_70 (
japanese_title VARCHAR,
average_ratings VARCHAR,
episodes VARCHAR,
tv_station VARCHAR
) | What is the Japanese title for the episode bigger than 10 on TBS with average ratings of 14.8%? | SELECT japanese_title FROM table_name_70 WHERE episodes > 10 AND tv_station = "tbs" AND average_ratings = "14.8%" | sql_create_context |
CREATE TABLE table_name_75 (
condition VARCHAR,
bleeding_time VARCHAR,
prothrombin_time VARCHAR
) | Which Condition has a Bleeding time of unaffected and a Prothrombin time of prolonged? | SELECT condition FROM table_name_75 WHERE bleeding_time = "unaffected" AND prothrombin_time = "prolonged" | sql_create_context |
CREATE TABLE table_48425 (
"Season" text,
"Skip" text,
"Third" text,
"Second" text,
"Lead" text,
"Alternate" text,
"Events" text
) | Which lead had a season of 2009-10? | SELECT "Lead" FROM table_48425 WHERE "Season" = '2009-10' | wikisql |
CREATE TABLE table_name_8 (
venue VARCHAR,
score VARCHAR
) | Which venue had a score of 734-5d? | SELECT venue FROM table_name_8 WHERE score = "734-5d" | sql_create_context |
CREATE TABLE table_66215 (
"Rank" real,
"Athlete" text,
"Country" text,
"Time" text,
"Notes" text
) | what is the country when the nots is sa/b, the rank is more than 1 and the athlete is zhang xiuyun? | SELECT "Country" FROM table_66215 WHERE "Notes" = 'sa/b' AND "Rank" > '1' AND "Athlete" = 'zhang xiuyun' | wikisql |
CREATE TABLE table_15909 (
"Year" text,
"Typhus" real,
"Typhoid fever" real,
"Relapsing fever" real,
"Smallpox" real,
"Malaria" text
) | what is the number of relapsing fever when malaria is 3000 | SELECT MIN("Relapsing fever") FROM table_15909 WHERE "Malaria" = '3000' | wikisql |
CREATE TABLE appointment (
appointmentid number,
patient number,
prepnurse number,
physician number,
start time,
end time,
examinationroom text
)
CREATE TABLE affiliated_with (
physician number,
department number,
primaryaffiliation boolean
)
CREATE TABLE prescribes (
physi... | Find the three most expensive procedures. | SELECT name FROM procedures ORDER BY cost LIMIT 3 | spider |
CREATE TABLE table_name_94 (
number_of_electorates__2009_ VARCHAR,
district VARCHAR,
constituency_number VARCHAR
) | Which Number of electorates (2009) has a District of sheopur, and a Constituency number of 1? | SELECT COUNT(number_of_electorates__2009_) FROM table_name_94 WHERE district = "sheopur" AND constituency_number = "1" | sql_create_context |
CREATE TABLE table_32066 (
"Place" real,
"Team" text,
"Wins" real,
"Ties" real,
"Losses" real,
"Points" text
) | Name the total losses for 4 place and ties less than 0 | SELECT COUNT("Losses") FROM table_32066 WHERE "Place" = '4' AND "Ties" < '0' | wikisql |
CREATE TABLE mission (
Mission_ID int,
Ship_ID int,
Code text,
Launched_Year int,
Location text,
Speed_knots int,
Fate text
)
CREATE TABLE ship (
Ship_ID int,
Name text,
Type text,
Nationality text,
Tonnage int
) | Give me a stacked bar chart for showing the total number of each ship type and categorize it by ship nationality, and rank Y from low to high order. | SELECT Type, COUNT(Type) FROM ship GROUP BY Nationality, Type ORDER BY COUNT(Type) | nvbench |
CREATE TABLE match_season (
Season real,
Player text,
Position text,
Country int,
Team int,
Draft_Pick_Number int,
Draft_Class text,
College text
)
CREATE TABLE player (
Player_ID int,
Player text,
Years_Played text,
Total_WL text,
Singles_WL text,
Doubles_WL tex... | Show me a bar chart for what are the draft pick numbers and draft classes for players who play the Defender position?, display in descending by the Draft_Class. | SELECT Draft_Class, Draft_Pick_Number FROM match_season WHERE Position = "Defender" ORDER BY Draft_Class DESC | nvbench |
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE ReviewTaskResults (
Id number,
... | Questions Closed, Edited by No User Other Than OP, and Reopened. | SELECT i.PostId AS "post_link" FROM PostHistory AS i INNER JOIN PostHistory AS c ON i.PostId = c.PostId AND i.PostHistoryTypeId = 1 AND c.PostHistoryTypeId = 10 INNER JOIN PostHistory AS r ON c.PostId = r.PostId AND r.PostHistoryTypeId = 11 LEFT OUTER JOIN PostHistory AS e ON r.PostId = e.PostId AND e.PostHistoryTypeId... | sede |
CREATE TABLE rating (
rid number,
mid number,
stars number,
ratingdate time
)
CREATE TABLE reviewer (
rid number,
name text
)
CREATE TABLE movie (
mid number,
title text,
year number,
director text
) | What are the names of all the reviewers and movie names? | SELECT name FROM reviewer UNION SELECT title FROM movie | spider |
CREATE TABLE table_23944 (
"Type of Fare" text,
"Cash Fare" text,
"Day Pass" text,
"31-Day Pass" text,
"Monthly Pass" text
) | When mega pass* (senior/disabled) is the type of fare what is the day pass? | SELECT "Day Pass" FROM table_23944 WHERE "Type of Fare" = 'Mega Pass* (Senior/Disabled)' | wikisql |
CREATE TABLE table_name_50 (
caps INTEGER,
player VARCHAR
) | What is the largest caps value for Glen Moss? | SELECT MAX(caps) FROM table_name_50 WHERE player = "glen moss" | sql_create_context |
CREATE TABLE table_55023 (
"Peak" text,
"Height (m)" real,
"Prom. (m)" real,
"Class" text,
"Parent" text
) | Which class has a peak named fountains fell south top? | SELECT "Class" FROM table_55023 WHERE "Peak" = 'fountains fell south top' | wikisql |
CREATE TABLE table_37889 (
"Season" real,
"Network" text,
"Time slot" text,
"Season premiere" text,
"Season finale" text,
"Episode count" real,
"TV season" text,
"Season rank" text,
"Viewers (in millions)" real
) | How many total episodes aired over all seasons with 7.79 million viewers? | SELECT COUNT("Episode count") FROM table_37889 WHERE "Viewers (in millions)" = '7.79' | wikisql |
CREATE TABLE table_name_75 (
tickets_available_since VARCHAR,
venue VARCHAR,
date VARCHAR
) | How many tickets were available at Halle Tony Garnier on June 15, 2009? | SELECT tickets_available_since FROM table_name_75 WHERE venue = "halle tony garnier" AND date = "june 15, 2009" | sql_create_context |
CREATE TABLE jybgb (
YLJGDM text,
YLJGDM_MZJZJLB text,
YLJGDM_ZYJZJLB text,
BGDH text,
BGRQ time,
JYLX number,
JZLSH text,
JZLSH_MZJZJLB text,
JZLSH_ZYJZJLB text,
JZLX number,
KSBM text,
KSMC text,
SQRGH text,
SQRXM text,
BGRGH text,
BGRXM text,
SHRGH ... | 在06年2月16日到2012年12月29日内,患者86192991的甲胎蛋白情况如何? | (SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_info.RYBH = ... | css |
CREATE TABLE submission (
Submission_ID int,
Scores real,
Author text,
College text
)
CREATE TABLE workshop (
Workshop_ID int,
Date text,
Venue text,
Name text
)
CREATE TABLE Acceptance (
Submission_ID int,
Workshop_ID int,
Result text
) | How many workshops did each author submit to? Return the author name and the number of workshops by a pie chart. | SELECT Author, COUNT(DISTINCT T1.Workshop_ID) FROM Acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID | nvbench |
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE compartment_class (
compartment varchar,
class_type varchar
)
CREATE TABLE class_of_service (
booking_class varchar,
rank int,
class_description text
)
CREATE TABLE fare (
fare_id int,
from_... | on tuesday i'd like to find a flight from DETROIT to ST. PETERSBURG that arrives before 2200 | 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.arrival_time <... | atis |
CREATE TABLE Department_Stores (
dept_store_id INTEGER,
dept_store_chain_id INTEGER,
store_name VARCHAR(80),
store_address VARCHAR(255),
store_phone VARCHAR(80),
store_email VARCHAR(80)
)
CREATE TABLE Staff (
staff_id INTEGER,
staff_gender VARCHAR(1),
staff_name VARCHAR(80)
)
CREAT... | Return the names and ids of customers who have TN in their address. Show a pie chart. | SELECT customer_name, customer_id FROM Customers WHERE customer_address LIKE "%TN%" | nvbench |
CREATE TABLE table_12597 (
"State" text,
"Status" text,
"Association Agreement" text,
"Membership Application" text,
"Candidate status" text,
"Negotiations start" text,
"Screening completed" text,
"Acquis Chapters open/closed" text
) | What is the status of the membership application on 2008-12-15? | SELECT "Status" FROM table_12597 WHERE "Membership Application" = '2008-12-15' | wikisql |
CREATE TABLE table_33079 (
"sliding tackle" text,
"spear tackle" text,
"dump tackle" text,
"body tackle" text,
"ankle tap" text,
"diving tackle" text,
"bumping/blocking" text,
"shoulder charge" text,
"steal/intercept ball" text,
"Chicken wing" text
) | Which body tackle has yes for the diving tackle and the sliding tackle classified as a trip? | SELECT "body tackle" FROM table_33079 WHERE "diving tackle" = 'yes' AND "sliding tackle" = 'classified as a trip' | 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 demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | what is the number of newborn admitted patients who are diagnosed with loss of weight? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "NEWBORN" AND diagnoses.long_title = "Loss of weight" | mimicsql_data |
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_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '赵伟博' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' | css |
CREATE TABLE students_in_detention (
student_id number,
detention_id number,
incident_id number
)
CREATE TABLE ref_address_types (
address_type_code text,
address_type_description text
)
CREATE TABLE teachers (
teacher_id number,
address_id number,
first_name text,
middle_name text... | Find the id and city of the student address with the highest average monthly rental. | SELECT T2.address_id, T1.city FROM addresses AS T1 JOIN student_addresses AS T2 ON T1.address_id = T2.address_id GROUP BY T2.address_id ORDER BY AVG(monthly_rental) DESC LIMIT 1 | spider |
CREATE TABLE table_name_60 (
award VARCHAR,
outcome VARCHAR,
name VARCHAR
) | Anuya Bhagvath was nominated for what award? | SELECT award FROM table_name_60 WHERE outcome = "nominated" AND name = "anuya bhagvath" | sql_create_context |
CREATE TABLE table_name_42 (
grid INTEGER,
team VARCHAR,
laps VARCHAR
) | Which Grid is the lowest one that has a Team of germany, and Laps smaller than 45? | SELECT MIN(grid) FROM table_name_42 WHERE team = "germany" AND laps < 45 | sql_create_context |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospita... | has patient 010-37499's sao2 been normal since 182 days ago? | SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-37499')) AND vitalperiodic.sao2 BETWEEN sao2_lower AND sao2_uppe... | eicu |
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... | what were the three most frequent lab tests? | SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t1.itemid FROM (SELECT labevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM labevents GROUP BY labevents.itemid) AS t1 WHERE t1.c1 <= 3) | mimic_iii |
CREATE TABLE table_51839 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What was the away team's score when Collingwood was the home team? | SELECT "Away team score" FROM table_51839 WHERE "Home team" = 'collingwood' | wikisql |
CREATE TABLE table_204_794 (
id number,
"iec\nworld plugs\nType" text,
"standard" text,
"power\nrating" text,
"earthed" text,
"polarised" text,
"fused" text,
"insulated\npins" text,
"europlug\ncompatible" text
) | what is the last power rating on the chart ? | SELECT "power\nrating" FROM table_204_794 ORDER BY id DESC LIMIT 1 | squall |
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,
... | 在门诊检查的邹元良患者在查出疾病F78.797时的检测指标290838的结果定量及其单位各是多少? | SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZ... | css |
CREATE TABLE table_27965906_2 (
gt_winning_car VARCHAR,
a_winning_car VARCHAR
) | Name the gt winning car for #88 team mitsubishi 88 mitsubishi starion | SELECT gt_winning_car FROM table_27965906_2 WHERE a_winning_car = "#88 Team Mitsubishi 88 Mitsubishi Starion" | sql_create_context |
CREATE TABLE resultsdata15 (
sample_pk number,
commod text,
commtype text,
lab text,
pestcode text,
testclass text,
concen number,
lod number,
conunit text,
confmethod text,
confmethod2 text,
annotate text,
quantitate text,
mean text,
extract text,
determi... | show all imported samples? | SELECT sample_pk FROM sampledata15 WHERE origin = "2" | pesticide |
CREATE TABLE table_name_21 (
administration VARCHAR,
season VARCHAR,
division VARCHAR,
position VARCHAR
) | What is the administration when the division was Ykk nen (first division), and they were in the 1st position in 1996? | SELECT administration FROM table_name_21 WHERE division = "ykkönen (first division)" AND position = "1st" AND season = 1996 | sql_create_context |
CREATE TABLE table_name_36 (
latest_stable_release VARCHAR,
price_in_usd VARCHAR
) | Name the Latest stable release that has a Price in USD of free / negotiable? | SELECT latest_stable_release FROM table_name_36 WHERE price_in_usd = "free / negotiable" | 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,
... | 编码为12288921431的医疗就诊患者是什么时候出院的啊? | SELECT gwyjzb.OUT_HOSP_DATE FROM gwyjzb WHERE gwyjzb.MED_CLINIC_ID = '12288921431' UNION SELECT fgwyjzb.OUT_HOSP_DATE FROM fgwyjzb WHERE fgwyjzb.MED_CLINIC_ID = '12288921431' | css |
CREATE TABLE table_33107 (
"Week" real,
"Kickoff" text,
"Date" text,
"Opponent" text,
"Result" text,
"Record" text,
"Game Site" text,
"NFL.com Recap" text
) | Where did they play on their bye week? | SELECT "Game Site" FROM table_33107 WHERE "Record" = 'bye' | wikisql |
CREATE TABLE locations (
location_id number,
location_name text,
address text,
other_details text
)
CREATE TABLE staff (
staff_id number,
tourist_attraction_id number,
name text,
other_details text
)
CREATE TABLE theme_parks (
theme_park_id number,
theme_park_details text
)
CR... | Which tourist attractions are related to royal family? Tell me their details and how we can get there. | SELECT T1.royal_family_details, T2.how_to_get_there FROM royal_family AS T1 JOIN tourist_attractions AS T2 ON T1.royal_family_id = T2.tourist_attraction_id | spider |
CREATE TABLE table_2560677_1 (
end_date VARCHAR,
artist_s_ VARCHAR
) | What is the end date for the artist s. moldoff/j. giella/c. infantino? | SELECT end_date FROM table_2560677_1 WHERE artist_s_ = "S. Moldoff/J. Giella/C. Infantino" | sql_create_context |
CREATE TABLE table_60635 (
"Place" text,
"Player" text,
"Country" text,
"Score" real,
"To par" text
) | Which Country has a Score smaller than 70, and a Place of t3, and a Player of andr s romero? | SELECT "Country" FROM table_60635 WHERE "Score" < '70' AND "Place" = 't3' AND "Player" = 'andrés romero' | wikisql |
CREATE TABLE Apartment_Buildings (
building_id INTEGER,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80)
)
CREATE TABLE Apartment_Bookings (
apt_bookin... | Show the number of the facility codes of apartments with more than 4 bedrooms, and display by the Y-axis from high to low. | SELECT facility_code, COUNT(facility_code) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4 GROUP BY facility_code ORDER BY COUNT(facility_code) DESC | nvbench |
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment text,
Text text,
ContentLicense text
)
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
Cr... | Most recent rejected edits by anonymous users. | SELECT CASE WHEN VoteTypeId = 2 THEN 'Approved' ELSE 'Rejected' END AS "voted", STR(MONTH(SE.CreationDate)) + '/' + LTRIM(STR(YEAR(SE.CreationDate))) AS "date", COUNT(VoteTypeId) AS "suggested_edits" FROM SuggestedEditVotes AS SEV INNER JOIN SuggestedEdits AS SE ON (SE.Id = SEV.SuggestedEditId) WHERE TargetUserId IS NU... | sede |
CREATE TABLE table_30371 (
"No. in series" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" real
) | When did the episode titled 'Vanessa's new class' air for the first time? | SELECT "Original air date" FROM table_30371 WHERE "Title" = 'Vanessa''s New Class' | wikisql |
CREATE TABLE DEPARTMENT (
DPhone VARCHAR,
Room VARCHAR
) | What are the phones of departments in Room 268? | SELECT DPhone FROM DEPARTMENT WHERE Room = 268 | sql_create_context |
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,
... | how many patients whose procedure long title is open reduction of fracture with internal fixation, femur and lab test category is chemistry? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Open reduction of fracture with internal fixation, femur" AND lab."CATEGORY" = "Chemistry" | mimicsql_data |
CREATE TABLE table_65586 (
"Actor" text,
"Character" text,
"Soap Opera" text,
"Years" text,
"Duration" text
) | What years have a duration of 18 years, and patrizio rispo as the actor? | SELECT "Years" FROM table_65586 WHERE "Duration" = '18 years' AND "Actor" = 'patrizio rispo' | wikisql |
CREATE TABLE table_203_713 (
id number,
"s.no." number,
"name of kingdom" text,
"name of king" text,
"no. of villages" number,
"capital" text,
"names of districts" text
) | which kingdom contained the second most villages , next only to godara ? | SELECT "name of kingdom" FROM table_203_713 WHERE "no. of villages" < (SELECT "no. of villages" FROM table_203_713 WHERE "name of kingdom" = 'godara') ORDER BY "no. of villages" DESC LIMIT 1 | squall |
CREATE TABLE wine (
No INTEGER,
Grape TEXT,
Winery TEXT,
Appelation TEXT,
State TEXT,
Name TEXT,
Year INTEGER,
Price INTEGER,
Score INTEGER,
Cases INTEGER,
Drink TEXT
)
CREATE TABLE grapes (
ID INTEGER,
Grape TEXT,
Color TEXT
)
CREATE TABLE appellations (
No... | For those appellations whose score is higher than 93, return a stacked to group them by appellation, count appellation, and ordered by Name | SELECT Appelation, COUNT(Appelation) FROM wine WHERE Score > 93 GROUP BY Grape, Appelation ORDER BY Name | nvbench |
CREATE TABLE table_test_4 (
"id" int,
"ejection_fraction_ef" int,
"systolic_blood_pressure_sbp" int,
"active_infection" bool,
"heart_disease" bool,
"renal_disease" bool,
"estimated_glomerular_filtration_rate_egfr" int,
"cardiogenic_shock" bool,
"diastolic_blood_pressure_dbp" int,
... | cardiogenic shock or systolic bp < 100 mmhg or diastolic < 60 mmhg within the 24 hours prior to visits 1 or 2 | SELECT * FROM table_test_4 WHERE cardiogenic_shock = 1 OR systolic_blood_pressure_sbp < 100 OR diastolic_blood_pressure_dbp < 60 | criteria2sql |
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... | what is the number of patients whose discharge location is rehab/distinct part hosp and diagnoses short title is myalgia and myositis nos? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.discharge_location = "REHAB/DISTINCT PART HOSP" AND diagnoses.short_title = "Myalgia and myositis NOS" | mimicsql_data |
CREATE TABLE table_17607663_1 (
builder VARCHAR,
br_no VARCHAR
) | Who is the builder for br no. 31779? | SELECT builder FROM table_17607663_1 WHERE br_no = 31779 | sql_create_context |
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... | what is drug route of drug name potassium chl 40 meq / 1000 ml d5 1/2 ns? | SELECT prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Potassium Chl 40 mEq / 1000 mL D5 1/2 NS" | mimicsql_data |
CREATE TABLE t_kc21 (
CLINIC_ID text,
CLINIC_TYPE text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD text,
INPT_AREA_BED text,
INSURED_IDENTITY number,
INSURED_STS text,
... | 病号56549574药品金额不低于6975.76元的在哪几次医疗记录中被开出过?医疗就诊编号是多少呢? | SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_ID = '56549574' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT >= 6975.76) | css |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.