context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
... | this year, how many patients were prescribed potassium chloride in the same month after they had a analgesics - narcotic analgesic? | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'analgesics - narcotic analgesic' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_T... | eicu |
CREATE TABLE TRANSACTIONS (
transaction_id VARCHAR,
transaction_type_code VARCHAR
) | Show all transaction ids with transaction code 'PUR'. | SELECT transaction_id FROM TRANSACTIONS WHERE transaction_type_code = 'PUR' | sql_create_context |
CREATE TABLE table_30088 (
"\u2116" real,
"#" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" text,
"U.S. viewers (million)" text
) | How many episodes were directed by Ken Fink? | SELECT COUNT("#") FROM table_30088 WHERE "Directed by" = 'Ken Fink' | wikisql |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE cost (
costid number,
u... | what are the prices for fat emulsion 20 % iv emul? | SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'fat emulsion 20 % iv emul') | eicu |
CREATE TABLE table_25818630_2 (
candidate VARCHAR,
result____percentage VARCHAR
) | Who was the candidate when the result - % was 0.4%? | SELECT candidate FROM table_25818630_2 WHERE result____percentage = "0.4%" | sql_create_context |
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... | what is maximum days of hospital stay of patients whose year of death is less than 2111? | SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.dod_year < "2111.0" | mimicsql_data |
CREATE TABLE table_23845 (
"Seed" real,
"Player" text,
"Marseille (32 draw)" text,
"Metz (32)" text,
"Lyon (32)" text,
"Paris (48 - byes)" text
) | What was the result for Paris(48-byes) for 3 seed? | SELECT "Paris (48 - byes)" FROM table_23845 WHERE "Seed" = '3' | wikisql |
CREATE TABLE department (
dept_code text,
dept_name text,
school_code text,
emp_num number,
dept_address text,
dept_extension text
)
CREATE TABLE employee (
emp_num number,
emp_lname text,
emp_fname text,
emp_initial text,
emp_jobcode text,
emp_hiredate time,
emp_dob... | What are the first names of all professors who teach more than one class? | SELECT T2.emp_fname FROM class AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING COUNT(*) > 1 | spider |
CREATE TABLE table_17621978_11 (
location_attendance VARCHAR,
date VARCHAR
) | Name the number of location attendance for april 24 | SELECT COUNT(location_attendance) FROM table_17621978_11 WHERE date = "April 24" | sql_create_context |
CREATE TABLE table_42391 (
"Team" text,
"Match" real,
"Points" real,
"Draw" real,
"Lost" real
) | What is the largest number lost with 0 draws and less than 12 points for Gwardia Katowice? | SELECT MAX("Lost") FROM table_42391 WHERE "Draw" = '0' AND "Team" = 'gwardia katowice' AND "Points" < '12' | wikisql |
CREATE TABLE invoices (
invoice_number number,
order_id number,
invoice_date time
)
CREATE TABLE product_categories (
production_type_code text,
product_type_description text,
vat_rating number
)
CREATE TABLE order_items (
order_item_id number,
order_id number,
product_id number,
... | Show the account name and other account detail for all accounts by the customer with first name Meaghan and last name Keeling. | SELECT T1.account_name, T1.other_account_details FROM accounts AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Meaghan" AND T2.customer_last_name = "Keeling" | spider |
CREATE TABLE compartment_class (
compartment varchar,
class_type varchar
)
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
dual_airline varchar,
service_na... | show me the nonstop flights from NASHVILLE to ST. LOUIS | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'NASHVILLE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ST.... | atis |
CREATE TABLE Genre (
GenreId integer,
Name varchar(120)
)
CREATE TABLE Album (
AlbumId integer,
Title varchar(160),
ArtistId integer
)
CREATE TABLE Invoice (
InvoiceId integer,
CustomerId integer,
InvoiceDate datetime,
BillingAddress varchar(70),
BillingCity varchar(40),
Bi... | Find all invoice dates corresponding to customers with first name Astrid and last name Gruber, and count them by a bar chart, and show from low to high by the y-axis please. | SELECT InvoiceDate, COUNT(InvoiceDate) FROM Customer AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = "Astrid" AND LastName = "Gruber" ORDER BY COUNT(InvoiceDate) | nvbench |
CREATE TABLE table_12049 (
"Points" real,
"Name" text,
"Club" text,
"Apps" real,
"Tries" real,
"Drop" real
) | When the points are less than 65 what is the drop #? | SELECT COUNT("Drop") FROM table_12049 WHERE "Points" < '65' | wikisql |
CREATE TABLE table_42992 (
"Pos." text,
"Player" text,
"Team" text,
"Height" text,
"Weight" real
) | Which player who weighs 210 plays for the Reno Bighorns? | SELECT "Player" FROM table_42992 WHERE "Weight" = '210' AND "Team" = 'reno bighorns' | wikisql |
CREATE TABLE table_274117_5 (
seasons_by_team VARCHAR,
position VARCHAR,
number VARCHAR
) | What are seasons by team for Pro Bowl appearances of the player who was an OL and had 11 appearances? | SELECT seasons_by_team FROM table_274117_5 WHERE position = "OL" AND number = 11 | sql_create_context |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDat... | Downvotes as more than N% of votes. | SELECT Id AS "user_link", Reputation, UpVotes, DownVotes, (1.0 * DownVotes / (1.0 * UpVotes + 1.0 * DownVotes)) AS PercentDown FROM Users WHERE DownVotes > 0 AND (1.0 * DownVotes / (1.0 * UpVotes + 1.0 * DownVotes)) > @PERCENT / 100.0 AND (UpVotes + DownVotes) > @MIN_VOTES ORDER BY DownVotes DESC | sede |
CREATE TABLE table_name_41 (
record VARCHAR,
date VARCHAR
) | What was the record on April 16? | SELECT record FROM table_name_41 WHERE date = "april 16" | sql_create_context |
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
... | what is the average value of the arterial bp mean of patient 739? | 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 = 739)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arteri... | mimic_iii |
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25),
COUNTRY_ID varchar(2)
)
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE countries (
COUNTRY_ID... | For those employees who was hired before 2002-06-21, show me the trend about employee_id over hire_date with a line chart. | SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE HIRE_DATE < '2002-06-21' | nvbench |
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
) | For those records from the products and each product's manufacturer, a bar chart shows the distribution of headquarter and the average of code , and group by attribute headquarter. | SELECT T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter | nvbench |
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStat... | select id, score from posts order by score desc;. | SELECT Id, Score FROM Posts ORDER BY Score DESC | sede |
CREATE TABLE table_name_50 (
party VARCHAR,
counties_represented VARCHAR,
delegate VARCHAR
) | What party is the delegate of Turner, Frank S. Frank S. Turner of Howard County? | SELECT party FROM table_name_50 WHERE counties_represented = "howard" AND delegate = "turner, frank s. frank s. turner" | sql_create_context |
CREATE TABLE table_name_97 (
season VARCHAR,
name VARCHAR
) | What season had Marcio Lassiter? | SELECT season FROM table_name_97 WHERE name = "marcio lassiter" | sql_create_context |
CREATE TABLE table_name_84 (
score VARCHAR,
attendance VARCHAR,
home_team VARCHAR
) | What is Score, when Attendance is '76', and when Home Team is 'Meir Ka'? | SELECT score FROM table_name_84 WHERE attendance = "76" AND home_team = "meir ka" | sql_create_context |
CREATE TABLE Organisations (
organisation_id INTEGER,
organisation_type VARCHAR(10),
organisation_details VARCHAR(255)
)
CREATE TABLE Project_Staff (
staff_id DOUBLE,
project_id INTEGER,
role_code VARCHAR(10),
date_from DATETIME,
date_to DATETIME,
other_details VARCHAR(255)
)
CREAT... | What is the total amount of grant money given to each organization and what is its id. Show the correlation. | SELECT SUM(grant_amount), organisation_id FROM Grants GROUP BY organisation_id | nvbench |
CREATE TABLE table_40021 (
"Date" text,
"Score" text,
"Set 1" text,
"Set 2" text,
"Set 3" text,
"Set 4" text,
"Set 5" text,
"Total" text
) | What is the total with a 25-19 set 2 on Jun 17? | SELECT "Total" FROM table_40021 WHERE "Set 2" = '25-19' AND "Date" = 'jun 17' | wikisql |
CREATE TABLE person_info (
CSD text,
CSRQ time,
GJDM text,
GJMC text,
JGDM text,
JGMC text,
MZDM text,
MZMC text,
RYBH text,
XBDM number,
XBMC text,
XLDM text,
XLMC text,
XM text,
ZYLBDM text,
ZYMC text
)
CREATE TABLE hz_info (
KH text,
KLX number... | 列出在医院5511402中患者41068843就诊科室名称不包含肠镜的所有门诊就诊记录的流水号是什么? | SELECT wdmzjzjlb.JZLSH 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 = '41068843' AND hz_info.YLJGDM = '5511402' AND NOT wdmzjzjlb.JZKSMC LIKE '%肠镜%' UNION SELECT bdmzjzjlb.JZLSH FROM hz_info JOIN bdmzjzjlb ON hz_info.YL... | css |
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE cours... | What are the morning times for the RELIGION 465 course ? | SELECT DISTINCT course_offering.end_time, course_offering.start_time, semester.semester, semester.year FROM course, course_offering, semester WHERE course_offering.start_time < '12:00:00' AND course_offering.start_time >= '08:00:00' AND course.course_id = course_offering.course_id AND course.department = 'RELIGION' AND... | advising |
CREATE TABLE table_36630 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" real,
"Record" text
) | Score of 4 0 had what attendance number? | SELECT COUNT("Attendance") FROM table_36630 WHERE "Score" = '4–0' | wikisql |
CREATE TABLE table_2247 (
"Rank" real,
"Runs" real,
"Player" text,
"Matches" real,
"Innings" real,
"Not Out" real,
"Average" text
) | How many no outs for an average of 56.38? | SELECT COUNT("Not Out") FROM table_2247 WHERE "Average" = '56.38' | wikisql |
CREATE TABLE table_69017 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Decision" text,
"Attendance" real,
"Record" text
) | What is the record when Tampa Bay is the visitor? | SELECT "Record" FROM table_69017 WHERE "Visitor" = 'tampa bay' | wikisql |
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment tex... | Days to Close a Question by Creation Month. | SELECT date1, AVG(diff1) AS cnt FROM (SELECT DATEDIFF(day, d.CreationDate, ClosedDate) AS "diff1", FORMAT(d.CreationDate, 'yy-MM') AS "date1", FORMAT(d.ClosedDate, 'yy-MM') AS "date2", (d.Id) AS id FROM Posts AS d LEFT JOIN PostHistory AS ph ON ph.PostId = d.Id LEFT JOIN PostLinks AS pl ON pl.PostId = d.Id LEFT JOIN Po... | sede |
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
... | Who Has Answered My Questions?. | SELECT u.Id AS "userid", u.DisplayName AS "name", a.Id AS "post_link" FROM Users AS u INNER JOIN Posts AS a ON a.OwnerUserId = u.Id AND a.PostTypeId = 2 WHERE (a.ParentId IN (SELECT Id FROM Posts WHERE OwnerUserId = @UserId AND PostTypeId = 1)) ORDER BY u.DisplayName | sede |
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,
basic_type varchar,
engines int,
propulsion varchar,
wide_body varchar,
wing_span int,
length int,... | please list flights between SAN FRANCISCO and DENVER | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = '... | atis |
CREATE TABLE employee (
eid number(9,0),
name varchar2(30),
salary number(10,2)
)
CREATE TABLE certificate (
eid number(9,0),
aid number(9,0)
)
CREATE TABLE aircraft (
aid number(9,0),
name varchar2(30),
distance number(6,0)
)
CREATE TABLE flight (
flno number(4,0),
origin var... | How many flights in each destination city? Return a bar chart. | SELECT destination, COUNT(destination) FROM flight GROUP BY destination | nvbench |
CREATE TABLE table_63029 (
"Rank" real,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | What rank has a gold greater than 0, 0 as the bronze, with germany (ger) as the nation? | SELECT "Rank" FROM table_63029 WHERE "Gold" > '0' AND "Bronze" = '0' AND "Nation" = 'germany (ger)' | wikisql |
CREATE TABLE table_26386 (
"Branding" text,
"Callsign" text,
"Frequency" text,
"Power kW" text,
"Coverage" text
) | What is the frequency when radio station branding is 106.3 energy fm naga? | SELECT "Frequency" FROM table_26386 WHERE "Branding" = '106.3 Energy FM Naga' | wikisql |
CREATE TABLE table_18733814_2 (
points_classification VARCHAR,
winner VARCHAR
) | When philippe gilbert is the winner who is the points classification? | SELECT points_classification FROM table_18733814_2 WHERE winner = "Philippe Gilbert" | sql_create_context |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE vitalperiodic (
vitalperio... | what was the first value of patient 027-136480's laboratory test for alkaline phos. during their current hospital visit? | 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 = '027-136480' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'alkaline pho... | eicu |
CREATE TABLE table_10882 (
"Result" text,
"Record" text,
"Opponent" text,
"Method" text,
"Event" text,
"Round" real,
"Location" text
) | Which Result has the Event Strikeforce and the Method, Ko (spinning back fist)? | SELECT "Result" FROM table_10882 WHERE "Event" = 'strikeforce' AND "Method" = 'ko (spinning back fist)' | wikisql |
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
wardid number,
intime time,
outtime time
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
... | what are the three most frequently ordered specimen tests for patients that were previously diagnosed with other esophagitis within 2 months until 2 years ago? | SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_... | mimic_iii |
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_zyjzjlb (
JZLSH number,
... | 哪些工号及姓名的医务人员在患者94520266就诊过程中为他检测指标994830的,时间是从0三年十二月十四日到0八年十二月二十五日 | SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM 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.... | css |
CREATE TABLE files (
f_id number,
artist_name text,
file_size text,
duration text,
formats text
)
CREATE TABLE song (
song_name text,
artist_name text,
country text,
f_id number,
genre_is text,
rating number,
languages text,
releasedate time,
resolution number
)
... | What is the duration, file size, and song format for every pop song, ordered by title alphabetically? | SELECT T1.duration, T1.file_size, T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.genre_is = "pop" ORDER BY T2.song_name | spider |
CREATE TABLE procedures_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 outputevents (
row_id number,
subject_id number,
hadm_id number,... | how many people had died after being diagnosed with iatrogen cv infarc/hmrhg during the same month until 2100? | SELECT COUNT(DISTINCT t2.subject_id) FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_di... | mimic_iii |
CREATE TABLE table_204_437 (
id number,
"country" text,
"2014" text,
"2013" text,
"2012" text,
"2010" text,
"2009" text,
"2008" text,
"2007" text,
"2006" text,
"2005" text,
"2004" text,
"2003" text,
"2002" text
) | which countries had no listing for 2002 ? | SELECT "country" FROM table_204_437 WHERE "country" IS NULL | 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 lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,... | calculate the maximum age of patients who were admitted on or after 2131 and stayed in hospital for 27 days. | SELECT MAX(demographic.age) FROM demographic WHERE demographic.days_stay = "27" AND demographic.admityear >= "2131" | mimicsql_data |
CREATE TABLE table_20534 (
"#" real,
"Air Date" text,
"Timeslot" text,
"Rating" text,
"Share" real,
"18-49" text,
"Viewers" text,
"Weekly Rank" text
) | How many episodes have a weekly rank tba and are broadcast at 8:00 p.m.? | SELECT COUNT("#") FROM table_20534 WHERE "Weekly Rank" = 'TBA' AND "Timeslot" = '8:00 P.M.' | wikisql |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | My winner and loser answers. | SELECT CASE WHEN Q.AcceptedAnswerId = A.Id THEN 'Winner' WHEN Q.AcceptedAnswerId IS NULL THEN '...' ELSE 'Loser' END AS Status, A.Id AS "post_link", A.Score, CASE WHEN A.Id != W.Id THEN W.Score ELSE NULL END AS "winner_score", CASE WHEN A.Id != W.Id THEN (SELECT MAX(Posts.Score) FROM Posts WHERE ParentId = Q.Id) ELSE N... | sede |
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... | 患者65531997在01年7月20日到15年10月22日,是找的哪些工号及姓名的医务人员检测指标116352的 | SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM 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.... | css |
CREATE TABLE table_57368 (
"1973 Democratic run-off primary" text,
"Manhattan" text,
"The Bronx" text,
"Brooklyn" text,
"Queens" text,
"Richmond [Staten Is.]" text,
"Total" real
) | Which Manhattan number appeared when Richmond (Staten Island) was 78%? | SELECT "Manhattan" FROM table_57368 WHERE "Richmond [Staten Is.]" = '78%' | wikisql |
CREATE TABLE table_name_84 (
winning_team VARCHAR,
winning_driver VARCHAR,
fastest_lap VARCHAR
) | What winning team did Jonathan bomarito drive for when jonathan summerton had the fastest lap? | SELECT winning_team FROM table_name_84 WHERE winning_driver = "jonathan bomarito" AND fastest_lap = "jonathan summerton" | sql_create_context |
CREATE TABLE table_name_59 (
location VARCHAR,
distance VARCHAR
) | Which Location has a Distance of 10,000 m? | SELECT location FROM table_name_59 WHERE distance = "10,000 m" | sql_create_context |
CREATE TABLE table_28971 (
"Species" text,
"Common Name" text,
"Protein Name" text,
"Accession Number" text,
"NT Length" text,
"NT Identity" text,
"AA Length" text,
"AA Identity" text,
"E-Value" text
) | What is the aa length when the protein name is c11orf73? | SELECT "AA Length" FROM table_28971 WHERE "Protein Name" = 'C11orf73' | wikisql |
CREATE TABLE film_market_estimation (
estimation_id number,
low_estimate number,
high_estimate number,
film_id number,
type text,
market_id number,
year number
)
CREATE TABLE market (
market_id number,
country text,
number_cities number
)
CREATE TABLE film (
film_id number,... | Please list the years of film market estimations when the market is in country 'Japan' in descending order. | SELECT T1.year FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.market_id = T2.market_id WHERE T2.country = "Japan" ORDER BY T1.year DESC | spider |
CREATE TABLE table_name_55 (
round INTEGER,
player VARCHAR
) | What is the lowest round number in which Will Wilcox was selected? | SELECT MIN(round) FROM table_name_55 WHERE player = "will wilcox" | sql_create_context |
CREATE TABLE table_22444 (
"Position" real,
"Team" text,
"Played" real,
"Wins" real,
"Draws" real,
"Losses" real,
"Scored" real,
"Conceded" real,
"Points" real
) | How many points when the score is 14? | SELECT MIN("Points") FROM table_22444 WHERE "Scored" = '14' | 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
) | Ignore movies whose director is NULL. For each director, what are the titles and ratings for all the movies they reviewed? Show the result by a bar chart. | SELECT title, stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE director <> "null" | nvbench |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | what is the number of patients whose gender is f and primary disease is left femur fracture? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.diagnosis = "LEFT FEMUR FRACTURE" | mimicsql_data |
CREATE TABLE table_name_84 (
date VARCHAR,
opponent VARCHAR
) | What is Date, when Opponent is @ Carolina Hurricanes? | SELECT date FROM table_name_84 WHERE opponent = "@ carolina hurricanes" | sql_create_context |
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE jo... | Which class is the easiest I can take to the fulfill the PreMajor requirement ? | SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%PreMajor%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM progra... | advising |
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 demographic (... | what is admission type and death status of subject id 17595? | SELECT demographic.admission_type, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "17595" | mimicsql_data |
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... | give me the number of patients whose diagnoses short title is preterm nec 2000-2499g and drug route is ih? | 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.short_title = "Preterm NEC 2000-2499g" AND prescriptions.route = "IH" | mimicsql_data |
CREATE TABLE table_2517159_1 (
appearances VARCHAR,
name_of_bowl VARCHAR
) | Name the appearance for independence bowl | SELECT COUNT(appearances) FROM table_2517159_1 WHERE name_of_bowl = "Independence Bowl" | sql_create_context |
CREATE TABLE table_name_31 (
sales VARCHAR,
peak_position VARCHAR,
certification VARCHAR
) | How many sales had a peak position of 1 and a certification of 6x platinum? | SELECT COUNT(sales) FROM table_name_31 WHERE peak_position = 1 AND certification = "6x platinum" | 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 the minimum days of hospital stay of patients whose insurance is medicaid? | SELECT MIN(demographic.days_stay) FROM demographic WHERE demographic.insurance = "Medicaid" | mimicsql_data |
CREATE TABLE table_name_35 (
authority VARCHAR,
area VARCHAR
) | What authority does the rototuna area have? | SELECT authority FROM table_name_35 WHERE area = "rototuna" | sql_create_context |
CREATE TABLE table_70133 (
"Stage" text,
"Winner" text,
"General classification" text,
"Points classification" text,
"Mountains classification" text,
"Trofeo Fast Team" text
) | Who won stage 16? | SELECT "Winner" FROM table_70133 WHERE "Stage" = '16' | wikisql |
CREATE TABLE table_47112 (
"Club" text,
"Played" text,
"Drawn" text,
"Lost" text,
"Points for" text,
"Points against" text,
"Tries for" text,
"Tries against" text,
"Try bonus" text
) | What is the played number when the points against is 179? | SELECT "Played" FROM table_47112 WHERE "Points against" = '179' | wikisql |
CREATE TABLE jyjgzbb (
BGDH text,
BGRQ time,
CKZFWDX text,
CKZFWSX number,
CKZFWXX number,
JCFF text,
JCRGH text,
JCRXM text,
JCXMMC text,
JCZBDM text,
JCZBJGDL number,
JCZBJGDW text,
JCZBJGDX text,
JCZBMC text,
JLDW text,
JYRQ time,
JYZBLSH text,
... | 病患郑自珍大腿的检测各项指标结果如何? | SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM... | css |
CREATE TABLE table_77575 (
"Outcome" text,
"Year" real,
"Championship" text,
"Surface" text,
"Opponent in the final" text,
"Score in the final" text
) | What was the final score of the Australian Open? | SELECT "Score in the final" FROM table_77575 WHERE "Championship" = 'australian open' | wikisql |
CREATE TABLE table_name_39 (
date VARCHAR,
tournament VARCHAR
) | On what date was the Nike Colorado Classic held? | SELECT date FROM table_name_39 WHERE tournament = "nike colorado classic" | 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 d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE procedures_icd (
... | what is patient 6580's length of stay of the first hospital stay. | SELECT STRFTIME('%j', admissions.dischtime) - STRFTIME('%j', admissions.admittime) FROM admissions WHERE admissions.subject_id = 6580 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1 | mimic_iii |
CREATE TABLE table_name_53 (
high_assists VARCHAR,
game VARCHAR
) | Who has the highest assists in game 72? | SELECT high_assists FROM table_name_53 WHERE game = 72 | sql_create_context |
CREATE TABLE table_name_66 (
erp_w INTEGER,
frequency_mhz VARCHAR
) | What does the ERP W sum equal for 105.1 fm frequency? | SELECT SUM(erp_w) FROM table_name_66 WHERE frequency_mhz = "105.1 fm" | sql_create_context |
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,... | 在59467092414的医疗就诊中,是哪位医生负责这次医疗就诊的出院诊断的,想知道编码和名称 | SELECT OUT_DIAG_DOC_CD, OUT_DIAG_DOC_NM FROM t_kc21 WHERE MED_CLINIC_ID = '59467092414' | 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... | what is the number of patients whose primary disease is sigmoid diverticulitis, colovestical fistula/sda and drug route is po? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "SIGMOID DIVERTICULITIS, COLOVESTICAL FISTULA/SDA" AND prescriptions.route = "PO" | mimicsql_data |
CREATE TABLE table_name_30 (
host VARCHAR,
ratings VARCHAR
) | Who was the host that garnered ratings of 9.6/26? | SELECT host FROM table_name_30 WHERE ratings = "9.6/26" | sql_create_context |
CREATE TABLE table_204_322 (
id number,
"township" text,
"fips" number,
"population" number,
"population\ndensity\n/km2 (/sq mi)" text,
"land area\nkm2 (sq mi)" text,
"water area\nkm2 (sq mi)" text,
"water %" text,
"geographic coordinates" text
) | what townships have the same water area as lake township ? | SELECT "township" FROM table_204_322 WHERE "township" <> 'lake' AND "water area\nkm2 (sq mi)" = (SELECT "water area\nkm2 (sq mi)" FROM table_204_322 WHERE "township" = 'lake') | squall |
CREATE TABLE table_name_36 (
points_for VARCHAR,
points_against VARCHAR
) | The 51 points against, how many are for? | SELECT points_for FROM table_name_36 WHERE points_against = "51" | sql_create_context |
CREATE TABLE table_203_19 (
id number,
"number" number,
"builder" text,
"type" text,
"date" number,
"length" text,
"notes" text
) | did american car company or w.l. holman car company build cars that were 44 ' in length ? | SELECT DISTINCT "builder" FROM table_203_19 WHERE "length" = 44 | squall |
CREATE TABLE table_name_66 (
location_attendance VARCHAR,
date VARCHAR
) | What is the Location/Attendance on Dec 14? | SELECT location_attendance FROM table_name_66 WHERE date = "dec 14" | sql_create_context |
CREATE TABLE table_34027 (
"Site" text,
"Bebo" real,
"Facebook" real,
"Friendster" real,
"LinkedIn" real,
"MySpace" real,
"Ning" real,
"Orkut" real,
"Plaxo" real
) | What is the highest Ning that has a bebo less than 4, an orkut less than 100, with a plaxo greater than 0? | SELECT MAX("Ning") FROM table_34027 WHERE "Bebo" < '4' AND "Orkut" < '100' AND "Plaxo" > '0' | wikisql |
CREATE TABLE table_name_89 (
away_team VARCHAR,
venue VARCHAR
) | Who was the away team at Brunswick Street Oval? | SELECT away_team AS score FROM table_name_89 WHERE venue = "brunswick street oval" | sql_create_context |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
cha... | when for the first time until 31 months ago was patient 26922 prescribed d5w and furosemide at the same time? | SELECT t1.startdate FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'd5w' AND admissions.subject_id = 26922 AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-31 month')) AS t1 JOIN (... | mimic_iii |
CREATE TABLE table_61896 (
"Week 1" text,
"Week 2" text,
"Week 3" text,
"Week 4" text,
"Week 5" text
) | When Diane Deluna was the cyber girl in week 4 who was the cyber girl in week 2? | SELECT "Week 2" FROM table_61896 WHERE "Week 4" = 'diane deluna' | wikisql |
CREATE TABLE table_name_36 (
voice_actor__english_1998___pioneer_ VARCHAR,
voice_actor__english_1997___saban_ VARCHAR
) | what character did dave ward play | SELECT voice_actor__english_1998___pioneer_ FROM table_name_36 WHERE voice_actor__english_1997___saban_ = "dave ward" | sql_create_context |
CREATE TABLE table_10110 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What team played Essendon? | SELECT "Home team" FROM table_10110 WHERE "Away team" = 'essendon' | wikisql |
CREATE TABLE table_name_9 (
losses INTEGER,
draws VARCHAR,
against VARCHAR
) | What is the most games lost when the against is greater than 1401, and the draws greater than 0? | SELECT MAX(losses) FROM table_name_9 WHERE draws > 0 AND against > 1401 | sql_create_context |
CREATE TABLE table_53947 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Decision" text,
"Attendance" real,
"Record" text
) | When were the boston bruins the home team? | SELECT "Date" FROM table_53947 WHERE "Home" = 'boston bruins' | wikisql |
CREATE TABLE table_name_75 (
avg_g INTEGER,
name VARCHAR,
long VARCHAR
) | what is the avg/g for john conner when long is less than 25? | SELECT SUM(avg_g) FROM table_name_75 WHERE name = "john conner" AND long < 25 | sql_create_context |
CREATE TABLE table_37352 (
"Call sign" text,
"Frequency MHz" real,
"City of license" text,
"ERP W" real,
"Class" text,
"FCC info" text
) | What City of license has a Frequency MHz smaller than 95.9 with w223au as the call sign? | SELECT "City of license" FROM table_37352 WHERE "Frequency MHz" < '95.9' AND "Call sign" = 'w223au' | wikisql |
CREATE TABLE table_42352 (
"Rank" real,
"Name" text,
"Team" text,
"Games" real,
"Assists" real
) | What is the largest number of assists for the second rank when there were less than 2 games? | SELECT MAX("Assists") FROM table_42352 WHERE "Rank" = '2' AND "Games" < '2' | wikisql |
CREATE TABLE table_66899 (
"Year" text,
"Superintendent" text,
"Glendale Principal" text,
"H.H. Principal" text,
"Maplemere Principal" text,
"W.R. Principal" text,
"M.S. Principal" text,
"H.S. Principal" text,
"H. S. Asst. Principal" text
) | Who is the h.s. principal during 1973-1974? | SELECT "H.S. Principal" FROM table_66899 WHERE "Year" = '1973-1974' | wikisql |
CREATE TABLE table_37931 (
"Nation" text,
"Total wins" real,
"Team wins" real,
"Individual wins" real,
"Individual winners" real
) | Which Team wins has an Individual winner smaller than 1 and Total win larger than 1? | SELECT SUM("Team wins") FROM table_37931 WHERE "Individual winners" < '1' AND "Total wins" > '1' | wikisql |
CREATE TABLE wedding (
Church_ID int,
Male_ID int,
Female_ID int,
Year int
)
CREATE TABLE people (
People_ID int,
Name text,
Country text,
Is_Male text,
Age int
)
CREATE TABLE church (
Church_ID int,
Name text,
Organized_by text,
Open_Date int,
Continuation_of t... | Give me the trend about the number of church opening in each year, and display X-axis from low to high order. | SELECT Open_Date, COUNT(Open_Date) FROM church GROUP BY Open_Date ORDER BY Open_Date | nvbench |
CREATE TABLE table_58221 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | Which grid is lower for thierry boutsen which laps less than 44? | SELECT MIN("Grid") FROM table_58221 WHERE "Driver" = 'thierry boutsen' AND "Laps" < '44' | wikisql |
CREATE TABLE table_204_77 (
id number,
"number" text,
"builder" text,
"type" text,
"date" text,
"works number" number,
"notes" text
) | how many different types of diesel locomotives came from baldwin locomotive works ? | SELECT COUNT(DISTINCT "type") FROM table_204_77 WHERE "builder" = 'baldwin locomotive works' | squall |
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 was patient 23070 first tested for mchc a month before? | SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'mchc') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23070) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_T... | mimic_iii |
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... | Show all allergy types and the number of allergies in each type in a bar chart, rank total number in ascending order. | SELECT AllergyType, COUNT(*) FROM Allergy_Type GROUP BY AllergyType ORDER BY COUNT(*) | nvbench |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.