context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE table_name_4 (
losses VARCHAR,
against VARCHAR,
byes VARCHAR
) | What is the total number of losses against 1412, and Byes less than 2? | SELECT COUNT(losses) FROM table_name_4 WHERE against = 1412 AND byes < 2 | sql_create_context |
CREATE TABLE table_name_63 (
weight INTEGER,
position VARCHAR,
name VARCHAR
) | What is the average weight of Jeremy Case, who plays guard? | SELECT AVG(weight) FROM table_name_63 WHERE position = "guard" AND name = "jeremy case" | sql_create_context |
CREATE TABLE table_name_34 (
city__town VARCHAR,
year_founded VARCHAR
) | In what City/town was their institution founded in 1860? | SELECT city__town FROM table_name_34 WHERE year_founded = 1860 | sql_create_context |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
sy... | the number of times that patient 018-20179 had been prescribed levaquin since 121 months ago. | SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '018-20179')) AND medication.drugname = 'levaquin' AND DATETIME(medication.drug... | eicu |
CREATE TABLE table_name_9 (
losses INTEGER,
manager VARCHAR,
wins VARCHAR
) | What was Jim Hoff's sum of losses and a wins smaller than 12? | SELECT SUM(losses) FROM table_name_9 WHERE manager = "jim hoff" AND wins < 12 | sql_create_context |
CREATE TABLE table_name_51 (
region__year_ VARCHAR,
no_7 VARCHAR,
no_2 VARCHAR
) | What is Region (Year), when No. 7 is William, and when No. 2 is Alexander? | SELECT region__year_ FROM table_name_51 WHERE no_7 = "william" AND no_2 = "alexander" | sql_create_context |
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE intakeoutput (
in... | since 2102, when did patient 022-157712 receive a procedure for the first time? | SELECT 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 = '022-157712')) AND STRFTIME('%y', treatment.treatmenttime) >= '210... | eicu |
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE T... | Total number of Tags and active Tag Synomyms. | WITH numTags AS (SELECT 'Number of Tags' AS "item", COUNT(t.Id) AS "count" FROM Tags AS t), numSyns AS (SELECT 'Number of active Synonyms' AS "item", COUNT(ts.Id) AS "count" FROM TagSynonyms AS ts WHERE NOT ts.ApprovalDate IS NULL) SELECT 'item', 'count' FROM numTags UNION ALL SELECT 'item', 'count' FROM numSyns UNION ... | sede |
CREATE TABLE table_6383 (
"Games" real,
"Drawn" real,
"Lost" real,
"Points difference" text,
"Points" real
) | How many total drawn has less than 4 lost and 8 points? | SELECT SUM("Drawn") FROM table_6383 WHERE "Lost" < '4' AND "Points" = '8' | wikisql |
CREATE TABLE table_name_30 (
lane INTEGER,
nationality VARCHAR,
rank VARCHAR
) | for the rank more than 1 and nationality of netherlands, what is the lane? | SELECT AVG(lane) FROM table_name_30 WHERE nationality = "netherlands" AND rank > 1 | sql_create_context |
CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE compartment_class (
compartment varchar,
class_type varchar
)
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
... | are there any CO flights between DALLAS and BOSTON | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS... | atis |
CREATE TABLE table_15740 (
"Discipline" text,
"2003 Cadiz" text,
"2007 Cascais" text,
"2011 Perth" text,
"2014 Santander" text
) | What is the 2014 Santander together with 2003 Cadiz of Finn ? | SELECT "2014 Santander" FROM table_15740 WHERE "2003 Cadiz" = 'finn' | wikisql |
CREATE TABLE table_name_27 (
college VARCHAR,
pick INTEGER
) | Which colleges have a pick above 7? | SELECT college FROM table_name_27 WHERE pick > 7 | sql_create_context |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE diagnosis (
diagnosisid number,
... | what were the top three frequently prescribed drugs that patients were prescribed within the same month after having been diagnosed with sepsis - sepsis with multi-organ dysfunction this year? | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'sepsis - sepsis with multi-organ dysfunction' AND ... | eicu |
CREATE TABLE table_name_94 (
gymnast VARCHAR,
b_score VARCHAR,
a_score VARCHAR
) | Which gymnast had a b score of 8.95 and an a score less than 6.9 | SELECT gymnast FROM table_name_94 WHERE b_score = 8.95 AND a_score < 6.9 | sql_create_context |
CREATE TABLE table_174266_6 (
two_years INTEGER,
unknown INTEGER
) | If unknown is larger than 1.0, what is the maximum two year amount? | SELECT MAX(two_years) FROM table_174266_6 WHERE unknown > 1.0 | sql_create_context |
CREATE TABLE table_11577996_1 (
year VARCHAR
) | What school took 3rd place in 2007? | SELECT 3 AS rd_place FROM table_11577996_1 WHERE year = 2007 | sql_create_context |
CREATE TABLE table_name_68 (
lane INTEGER,
mark VARCHAR
) | What's the lowest lane found for a mark of 8.09 pb? | SELECT MIN(lane) FROM table_name_68 WHERE mark = "8.09 pb" | 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... | count the number of patients whose diagnoses long title is other diseases of lung, not elsewhere classified and drug type is additive? | 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 diseases of lung, not elsewhere classified" AND prescriptions.drug_type = "ADDITIVE" | mimicsql_data |
CREATE TABLE table_72625 (
"Year" real,
"Mens singles" text,
"Womens singles" text,
"Mens doubles" text,
"Womens doubles" text,
"Mixed doubles" text
) | In 2004, where the womens singles is daniela kressig who is the mens singles | SELECT "Mens singles" FROM table_72625 WHERE "Womens singles" = 'Daniela Kressig' | wikisql |
CREATE TABLE table_name_36 (
points INTEGER,
lost VARCHAR,
position VARCHAR
) | What's the Points average with a Lost of 21, and Position of 22? | SELECT AVG(points) FROM table_name_36 WHERE lost = 21 AND position = 22 | sql_create_context |
CREATE TABLE course_tags_count (
course_id int,
clear_grading int,
pop_quiz int,
group_projects int,
inspirational int,
long_lectures int,
extra_credit int,
few_tests int,
good_feedback int,
tough_tests int,
heavy_papers int,
cares_for_students int,
heavy_assignments ... | For next semester , what is the number of SAC classes offered ? | SELECT COUNT(DISTINCT course_offering.course_id) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'SAC' AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016 | advising |
CREATE TABLE table_name_73 (
silver INTEGER,
bronze INTEGER
) | How many Silver medals did the Nation with 10 or more Bronze receive? | SELECT MIN(silver) FROM table_name_73 WHERE bronze > 10 | sql_create_context |
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Tags (
Id number,
TagName text,
... | The Tag ordered by count. Enter Query Description | SELECT ROW_NUMBER() OVER (ORDER BY Count DESC) AS rn, Count, TagName FROM Tags ORDER BY Count DESC | sede |
CREATE TABLE table_204_525 (
id number,
"rank" number,
"player" text,
"county" text,
"tally" text,
"total" number,
"opposition" text
) | was pat enright in rank 5 or rank 9 ? | SELECT "rank" FROM table_204_525 WHERE "player" = 'pat enright' AND "rank" IN (5, 9) | squall |
CREATE TABLE tip (
tip_id int,
business_id varchar,
text longtext,
user_id varchar,
likes int,
year int,
month varchar
)
CREATE TABLE checkin (
cid int,
business_id varchar,
count int,
day varchar
)
CREATE TABLE business (
bid int,
business_id varchar,
name varc... | List all users who reviewed businesses that are restaurant in 2010 . | SELECT user.name FROM business, category, review, user WHERE category.business_id = business.business_id AND category.category_name = 'restaurant' AND review.business_id = business.business_id AND review.year = 2010 AND user.user_id = review.user_id | yelp |
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
) | For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and price , and group by attribute name. | SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name | nvbench |
CREATE TABLE table_75285 (
"Series Ep." text,
"Episode" real,
"Netflix" text,
"Segment A" text,
"Segment B" text,
"Segment C" text,
"Segment D" text
) | What is the series episode number with a segment of D, and having fluorescent tubes? | SELECT "Series Ep." FROM table_75285 WHERE "Segment D" = 'fluorescent tubes' | wikisql |
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate ti... | examples that have a cli command. | SELECT P.Id, P.Tags FROM Posts AS P WHERE P.AnswerCount > 0 AND P.Tags LIKE '%##azure-cli##%' LIMIT 600 | sede |
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
... | count the number of patients who were prescribed sw during the same hospital visit after being diagnosed with hx-lymphatic malign nec in a year before. | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id 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_diagnoses.short_title =... | mimic_iii |
CREATE TABLE table_name_53 (
seating VARCHAR,
diagram_no VARCHAR,
type VARCHAR
) | Which vehicle has a Diagram of 516 or smaller, and a driving motor brake second (dmbs) type. | SELECT seating FROM table_name_53 WHERE diagram_no > 516 AND type = "driving motor brake second (dmbs)" | sql_create_context |
CREATE TABLE table_60477 (
"Edition" text,
"Round" text,
"Date" text,
"Surface" text,
"Opponent" text,
"Result" text
) | Who was the opponent on april 24, 1999? | SELECT "Opponent" FROM table_60477 WHERE "Date" = 'april 24, 1999' | wikisql |
CREATE TABLE table_8504 (
"Date" text,
"Time" text,
"Home" text,
"Guest" text,
"Result" text
) | Who was the guest when the result was 0:3? | SELECT "Guest" FROM table_8504 WHERE "Result" = '0:3' | wikisql |
CREATE TABLE table_name_82 (
upstream VARCHAR,
downstream VARCHAR
) | What is the upstream for the 100 mbps downstream? | SELECT upstream FROM table_name_82 WHERE downstream = "100 mbps" | sql_create_context |
CREATE TABLE table_name_25 (
tournament VARCHAR
) | What is the name of the tournament that has the results of 2003 2r and 2004 1r? | SELECT tournament FROM table_name_25 WHERE 2003 = "2r" AND 2004 = "1r" | sql_create_context |
CREATE TABLE sampledata15 (
sample_pk number,
state text,
year text,
month text,
day text,
site text,
commod text,
source_id text,
variety text,
origin text,
country text,
disttype text,
commtype text,
claim text,
quantity number,
growst text,
packst t... | Which state produce the most organic food? | SELECT state FROM sampledata15 WHERE claim = "PO" GROUP BY state ORDER BY COUNT(*) DESC LIMIT 1 | pesticide |
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
ViewCount number,
Body text,
OwnerUserId number,
OwnerDisplayName text,
LastEditorUserId number,
LastEditorDisplayName text... | Top 50 users from Germany. | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, Location FROM Users WHERE LOWER(Location) LIKE '%germany%' ORDER BY Reputation DESC LIMIT 50 | sede |
CREATE TABLE table_166346_1 (
country VARCHAR,
production___bbl__day_ VARCHAR
) | Which country had a production (bbl/day) of 2,494,000 (10th)? | SELECT country FROM table_166346_1 WHERE production___bbl__day_ = "2,494,000 (10th)" | sql_create_context |
CREATE TABLE table_18937 (
"Club" text,
"Played" text,
"Won" text,
"Drawn" text,
"Lost" text,
"Points for" text,
"Points against" text,
"Tries for" text,
"Tries against" text,
"Try bonus" text,
"Losing bonus" text,
"Points" text
) | Name the try bonus for tries against is 70 | SELECT "Try bonus" FROM table_18937 WHERE "Tries against" = '70' | wikisql |
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CRE... | Comments containing string1 but not string2. | SELECT Id AS "comment_link", Text, UserId AS "user_link", CreationDate FROM Comments WHERE Text LIKE '%##string1##%' AND NOT (Text LIKE '%##string2##%') ORDER BY CreationDate DESC | sede |
CREATE TABLE table_name_75 (
rank INTEGER,
nationality VARCHAR
) | What is the highest place of a swimmer from the Netherlands? | SELECT MAX(rank) FROM table_name_75 WHERE nationality = "netherlands" | sql_create_context |
CREATE TABLE Lessons (
lesson_id INTEGER,
customer_id INTEGER,
lesson_status_code VARCHAR(15),
staff_id INTEGER,
vehicle_id INTEGER,
lesson_date DATETIME,
lesson_time VARCHAR(10),
price DOUBLE
)
CREATE TABLE Customer_Payments (
customer_id INTEGER,
datetime_payment DATETIME,
... | Show the total number from each payment method code | SELECT payment_method_code, COUNT(*) FROM Customer_Payments GROUP BY payment_method_code | nvbench |
CREATE TABLE table_1859269_1 (
round VARCHAR,
winners_from_previous_round VARCHAR
) | If the winners from the previous round is 8, what is the round? | SELECT round FROM table_1859269_1 WHERE winners_from_previous_round = "8" | sql_create_context |
CREATE TABLE table_name_39 (
attendance INTEGER,
opponent VARCHAR
) | What was the average attendance for games played at Atlanta Falcons? | SELECT AVG(attendance) FROM table_name_39 WHERE opponent = "at atlanta falcons" | sql_create_context |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | what is the number of patients whose primary disease is coronary artery disease and year of birth is less than 2110? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE" AND demographic.dob_year < "2110" | mimicsql_data |
CREATE TABLE table_55825 (
"Year" real,
"Championship" text,
"54 holes" text,
"Winning score" text,
"Margin" text,
"Runner(s)-up" text
) | What is the round of 54 holes in which Phil Mickelson was the runner-up? | SELECT "54 holes" FROM table_55825 WHERE "Runner(s)-up" = 'phil mickelson' | wikisql |
CREATE TABLE table_2592308_1 (
denominations__gold_weight_ VARCHAR,
country VARCHAR
) | What are all the denominations for China? | SELECT denominations__gold_weight_ FROM table_2592308_1 WHERE country = "China" | sql_create_context |
CREATE TABLE table_50520 (
"Nominative" text,
"Ergative" text,
"Dative" text,
"Genitive" text,
"Instrumental" text,
"Adverbial" text
) | With chem-s as the dative, what is the ergative? | SELECT "Ergative" FROM table_50520 WHERE "Dative" = 'chem-s' | wikisql |
CREATE TABLE table_28005809_2 (
alliance INTEGER,
total VARCHAR
) | What is the smallest Alliance where the total is 25? | SELECT MIN(alliance) FROM table_28005809_2 WHERE total = 25 | sql_create_context |
CREATE TABLE table_20711545_1 (
lyon__32_ VARCHAR,
seed VARCHAR
) | In what round was lyon (32) a 5 seed? | SELECT lyon__32_ FROM table_20711545_1 WHERE seed = 5 | sql_create_context |
CREATE TABLE table_name_37 (
lner_class VARCHAR,
passed_to_lner VARCHAR,
date_introduced VARCHAR
) | Which LNER class has been Passed to LNER larger than 3 and a introduced in 1895 98? | SELECT lner_class FROM table_name_37 WHERE passed_to_lner > 3 AND date_introduced = "1895–98" | 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... | provide the number of patients whose diagnoses icd9 code is 07054 and lab test fluid is ascites? | 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.icd9_code = "07054" AND lab.fluid = "Ascites" | mimicsql_data |
CREATE TABLE table_372 (
"Rank" real,
"English title" text,
"Chinese title" text,
"Average" real,
"Peak" real,
"Premiere" real,
"Finale" real,
"HK viewers" text
) | What is the Chinese name that has a 31 average? | SELECT "Chinese title" FROM table_372 WHERE "Average" = '31' | wikisql |
CREATE TABLE zzmzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH number,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
KH text,
KLX number,
MJZH text,
ML number,
MZZYZDZZBM text,
MZZYZDZ... | 在01年1月1日到21年9月10日内医疗机构4671519特需门诊的就诊记录数量一共有多少条? | SELECT COUNT(*) FROM zzmzjzjlb WHERE zzmzjzjlb.YLJGDM = '4671519' AND zzmzjzjlb.JZKSRQ BETWEEN '2001-01-01' AND '2021-09-10' AND zzmzjzjlb.TXBZ > 0 UNION SELECT COUNT(*) FROM fzzmzjzjlb WHERE fzzmzjzjlb.YLJGDM = '4671519' AND fzzmzjzjlb.JZKSRQ BETWEEN '2001-01-01' AND '2021-09-10' AND fzzmzjzjlb.TXBZ > 0 | css |
CREATE TABLE table_70901 (
"Year" real,
"Single" text,
"U.S. Hot 100" text,
"U.S. Dance" text,
"U.S. R&B" text,
"Album" text
) | Name the US dance when the year is more than 1985 | SELECT "U.S. Dance" FROM table_70901 WHERE "Year" > '1985' | wikisql |
CREATE TABLE table_train_7 (
"id" int,
"bleeding" int,
"hypotension" bool,
"burn_injury" int,
"hypoperfusion" bool,
"hypertension" bool,
"age" float,
"lactate" int,
"NOUSE" float
) | acute burn injury ( > 10 % body surface area ) | SELECT * FROM table_train_7 WHERE burn_injury > 10 | criteria2sql |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREA... | is sao2 of patient 006-2586 last measured on the current intensive care unit visit greater than first measured on the current intensive care unit visit? | SELECT (SELECT vitalperiodic.sao2 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-2586') AND patient.unitdischargetime IS NULL) AND ... | eicu |
CREATE TABLE table_2632 (
"District" text,
"Vacator" text,
"Reason for change" text,
"Successor" text,
"Date successor seated" text
) | Who is the successor when the reason for change is died November 11, 1845? | SELECT "Successor" FROM table_2632 WHERE "Reason for change" = 'Died November 11, 1845' | wikisql |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREAT... | when did it last happen on this month/31 that the respiration of patient 030-44598 was less than 21.0? | SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-44598')) AND vitalperiodic.respiration < 21.0 A... | eicu |
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
HIRE_DATE date,
JO... | For those employees who was hired before 2002-06-21, return a line chart about the change of salary over hire_date , and rank in descending by the x axis. | SELECT HIRE_DATE, SALARY FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY HIRE_DATE DESC | nvbench |
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
s... | what is the average daily number of patients who have had hemangioma intracranial during the last year? | SELECT AVG(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'hemangioma intracranial') AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_TI... | mimic_iii |
CREATE TABLE table_name_26 (
countries_visited VARCHAR,
episode_no VARCHAR,
writer VARCHAR
) | Which countries visited had an episode number of less than 7 when Ray Gosling was the writer? | SELECT countries_visited FROM table_name_26 WHERE episode_no < 7 AND writer = "ray gosling" | sql_create_context |
CREATE TABLE table_name_41 (
constituency VARCHAR,
candidate VARCHAR,
position VARCHAR,
party VARCHAR,
election VARCHAR
) | Which Alliance Constituency has Seamus Close, position 2 and an election smaller than 1997? | SELECT constituency FROM table_name_41 WHERE party = "alliance" AND election < 1997 AND position = 2 AND candidate = "seamus close" | sql_create_context |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id... | How many patients are diagnosed with single lb in-hosp w/o cs and drug route = sl? | 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 = "Single lb in-hosp w/o cs" AND prescriptions.route = "SL" | mimicsql_data |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE vitalperiodic (
vitalpe... | count the number of patients who were prescribed atropine injection 0.5 mg in the same month after receiving the normal saline administration procedure in the last year. | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'normal saline administration' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME... | eicu |
CREATE TABLE table_24257833_4 (
major_version VARCHAR,
release_date VARCHAR,
minor_version VARCHAR
) | List major versions released on May 12, 2009, that had a minor version of 3.2.3. | SELECT major_version FROM table_24257833_4 WHERE release_date = "May 12, 2009" AND minor_version = "3.2.3" | sql_create_context |
CREATE TABLE Rooms (
bedType VARCHAR
) | Find the number of rooms with a king bed. | SELECT COUNT(*) FROM Rooms WHERE bedType = "King" | sql_create_context |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE diagnosis (
diagnosisid number... | what is the percentile of 232.0 of a platelets x 1000 lab test based on the same age of patient 017-16041 on the current hospital visit? | SELECT DISTINCT t1.c1 FROM (SELECT lab.labresult, PERCENT_RANK() OVER (ORDER BY lab.labresult) AS c1 FROM lab WHERE lab.labname = 'platelets x 1000' AND lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age = (SELECT patient.age FROM patient WHERE patient.uniquepid = '017-16041' AND ... | eicu |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | Random questions on a site. | SELECT p.Id AS "post_link", p.* FROM Posts AS p WITH (nolock) WHERE p.PostTypeId IN (1) ORDER BY NEWID() | sede |
CREATE TABLE table_name_51 (
rank INTEGER,
total VARCHAR,
gold VARCHAR
) | What is the rank of the Nation that has fewer than 24 total medals are more than 7 Gold medals? | SELECT AVG(rank) FROM table_name_51 WHERE total < 24 AND gold > 7 | sql_create_context |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)... | did patient 027-194474 have anything diagnosed since 5 years ago? | SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-194474')) AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME... | eicu |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | what is the number of patients admitted via emergency hospital room who have procedure icd9 code 9744? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND procedures.icd9_code = "9744" | mimicsql_data |
CREATE TABLE table_203_697 (
id number,
"player" text,
"career" text,
"nickname" text,
"team inducted as" text
) | which team had the highest number of inductees ? | SELECT "team inducted as" FROM table_203_697 GROUP BY "team inducted as" ORDER BY COUNT("player") DESC LIMIT 1 | squall |
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
) | For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of founder and the sum of code , and group by attribute founder, show by the X from low to high. | SELECT T2.Founder, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Founder ORDER BY T2.Founder | nvbench |
CREATE TABLE table_71391 (
"Rank" real,
"Lane" real,
"Name" text,
"Nationality" text,
"Time" text
) | What is the highest rank of a swimmer in lane 5? | SELECT MAX("Rank") FROM table_71391 WHERE "Lane" = '5' | wikisql |
CREATE TABLE geographic (
city_name varchar,
county varchar,
region varchar
)
CREATE TABLE restaurant (
id int,
name varchar,
food_type varchar,
city_name varchar,
rating "decimal
)
CREATE TABLE location (
restaurant_id int,
house_number int,
street_name varchar,
city_n... | where are some restaurants good for french food in the yosemite and mono lake area ? | SELECT location.house_number, restaurant.name FROM geographic, location, restaurant WHERE geographic.region = 'yosemite and mono lake area' AND restaurant.city_name = geographic.city_name AND restaurant.food_type = 'french' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5 | restaurants |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
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
)
... | did patient 67418 ever have dpt administration since 2101? | SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'dpt administration') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 67418) AND STRFTIME('%y', pr... | mimic_iii |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,... | For those employees who do not work in departments with managers that have ids between 100 and 200, find hire_date and the average of manager_id bin hire_date by time, and visualize them by a bar chart, rank in desc by the y axis. | SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(MANAGER_ID) DESC | nvbench |
CREATE TABLE table_name_60 (
date VARCHAR,
opponent_in_the_final VARCHAR
) | When did Mathieu play against Antonio Vei ? | SELECT date FROM table_name_60 WHERE opponent_in_the_final = "antonio veić" | sql_create_context |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text,
first_wardid number,
... | what is the total number of days that have passed since patient 9964's last creatine kinase (ck) lab test during the current hospital visit? | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', labevents.charttime)) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'creatine kinase (ck)') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9964 AND... | mimic_iii |
CREATE TABLE Shops (
Shop_ID INTEGER,
Shop_Details VARCHAR(255)
)
CREATE TABLE Hotels (
hotel_id INTEGER,
star_rating_code CHAR(15),
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255)
)
CREATE TABLE Photos (
Photo_ID INTEGER,
Tourist_Attraction_ID INTEGER,
... | Find all the distinct visit dates, and count them by a line chart, I want to order x axis in desc order. | SELECT Visit_Date, COUNT(Visit_Date) FROM Visits ORDER BY Visit_Date DESC | nvbench |
CREATE TABLE table_name_88 (
score VARCHAR,
date VARCHAR
) | What is the score on April 12? | SELECT score FROM table_name_88 WHERE date = "april 12" | sql_create_context |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit ... | what were the hospital admission times of patient 12775? | SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 12775 | mimic_iii |
CREATE TABLE table_name_61 (
commenced_operations VARCHAR,
icao VARCHAR
) | What is the commenced operation where the ICAO is KAL? | SELECT commenced_operations FROM table_name_61 WHERE icao = "kal" | sql_create_context |
CREATE TABLE table_6199 (
"Date" real,
"Opponent" text,
"Venue" text,
"Result" text,
"Attendance" real,
"Competition" text
) | What is the date when the attendance is 960? | SELECT "Date" FROM table_6199 WHERE "Attendance" = '960' | wikisql |
CREATE TABLE table_name_65 (
snatch INTEGER,
bodyweight VARCHAR,
total__kg_ VARCHAR
) | Tell me the highest snatch for 68.63 bodyweight and total kg less than 290 | SELECT MAX(snatch) FROM table_name_65 WHERE bodyweight = 68.63 AND total__kg_ < 290 | sql_create_context |
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,
weight int,
capacity int,
pay_load int,
cruising_speed int,
range_... | flights from LGA or JFK to CLEVELAND | SELECT DISTINCT flight.flight_id FROM airport AS AIRPORT_0, airport AS AIRPORT_1, airport_service, city, flight WHERE ((flight.from_airport = AIRPORT_0.airport_code AND AIRPORT_0.airport_code = 'JFK') OR (flight.from_airport = AIRPORT_1.airport_code AND AIRPORT_1.airport_code = 'LGA')) AND city.city_code = airport_serv... | atis |
CREATE TABLE table_name_25 (
score VARCHAR,
player VARCHAR
) | What was gary player's score? | SELECT score FROM table_name_25 WHERE player = "gary player" | sql_create_context |
CREATE TABLE table_name_19 (
country VARCHAR,
year_s__won VARCHAR
) | Which country won in 1988? | SELECT country FROM table_name_19 WHERE year_s__won = "1988" | sql_create_context |
CREATE TABLE table_77139 (
"Team" text,
"Match" real,
"Points" real,
"Draw" real,
"Lost" real
) | What is the sum for the match with a draw less than 0? | SELECT SUM("Match") FROM table_77139 WHERE "Draw" < '0' | wikisql |
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Percent text,
ACC_Home text,
ACC_Road text,
All_Games text,
All_Games_Percent int,
All_Home text,
All_Road text,
All_Neutral text
)
CREATE TABLE university (
Scho... | Visualize a bar chart about the distribution of All_Home and Team_ID , and group by attribute ACC_Road. | SELECT All_Home, Team_ID FROM basketball_match GROUP BY ACC_Road, All_Home | nvbench |
CREATE TABLE table_62616 (
"Opposing Teams" text,
"Against" real,
"Date" text,
"Venue" text,
"Status" text
) | What is Venue, when Against is greater than 9, and when Date is '03/02/1996'? | SELECT "Venue" FROM table_62616 WHERE "Against" > '9' AND "Date" = '03/02/1996' | wikisql |
CREATE TABLE table_name_48 (
nba_draft VARCHAR,
college VARCHAR
) | What is the NBA draft result of the player from the College of Kansas? | SELECT nba_draft FROM table_name_48 WHERE college = "kansas" | sql_create_context |
CREATE TABLE table_name_42 (
built VARCHAR,
works_number VARCHAR
) | What is Built, when Works Number is '717'? | SELECT built FROM table_name_42 WHERE works_number = "717" | sql_create_context |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE cost (
row_id... | tell me the name of the lab test that patient 14467 received last since 158 months ago? | SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT labevents.itemid FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14467) AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_TIME(), '-158 month') ORDER BY labevents.charttime D... | mimic_iii |
CREATE TABLE table_name_56 (
ties INTEGER,
losses VARCHAR,
goals_against VARCHAR
) | Which team has the most ties with fewer than 4 losses and GA smaller than 20? | SELECT MAX(ties) FROM table_name_56 WHERE losses < 4 AND goals_against < 20 | sql_create_context |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime... | when has patient 005-87465 last had a platelets intake on this month/30? | SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-87465')) AND intakeoutput.cellpath LIKE '%intake%... | eicu |
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 ftxmzjzjlb (
HXPLC number,
HZ... | 患者秦承平的门诊诊断之前是什么样的? | SELECT txmzjzjlb.JZZDBM, txmzjzjlb.JZZDSM 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 = '秦承平' UNION SELECT ftxmzjzjlb.JZZDBM, ftxmzjzjlb.JZZDSM FROM person_info JO... | css |
CREATE TABLE table_203_271 (
id number,
"date" text,
"series" text,
"circuit" text,
"city / state" text,
"winner" text,
"team" text,
"car" text,
"report" text
) | how many races took place in new south wales ? | SELECT COUNT(*) FROM table_203_271 WHERE "city / state" = 'new south wales' | squall |
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... | 在2005年3月22日到2009年1月7日内患者14111458被开出几次盐酸多奈哌齐胶囊? | SELECT COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_ID = '14111458' AND t_kc22.STA_DATE BETWEEN '2005-03-22' AND '2009-01-07' AND t_kc22.SOC_SRT_DIRE_NM = '盐酸多奈哌齐胶囊' | css |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.