context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE table_30689 (
"Rank" real,
"Player" text,
"Year" real,
"Opponent" text,
"Passing yards" real,
"Rushing yards" real,
"Total offense" real
) | How may players have a passing yard score of 208? | SELECT COUNT("Player") FROM table_30689 WHERE "Passing yards" = '208' | wikisql |
CREATE TABLE management (
department_ID int,
head_ID int,
temporary_acting text
)
CREATE TABLE head (
head_ID int,
name text,
born_state text,
age real
)
CREATE TABLE department (
Department_ID int,
Name text,
Creation text,
Ranking int,
Budget_in_Billions real,
Num... | Show the number of heads of departments born in each state with a bar chart, and order in desc by the total number. | SELECT born_state, COUNT(born_state) FROM head GROUP BY born_state ORDER BY COUNT(born_state) DESC | nvbench |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
a... | calculate the number of patients who were tested for urine, voided specimen microbiology since 2104. | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT microlab.patientunitstayid FROM microlab WHERE microlab.culturesite = 'urine, voided specimen' AND STRFTIME('%y', microlab.culturetakentime) >= '2104') | eicu |
CREATE TABLE table_name_74 (
team VARCHAR,
home_city VARCHAR
) | What team has a home city of Velika? | SELECT team FROM table_name_74 WHERE home_city = "velika" | sql_create_context |
CREATE TABLE table_2232 (
"Pos" text,
"No" text,
"Driver" text,
"Constructor" text,
"Part 1" text,
"Part 2" text,
"Part 3" text,
"Grid" text
) | What was the time in part 3 when Heikki Kovalainen was the driver? | SELECT "Part 3" FROM table_2232 WHERE "Driver" = 'Heikki Kovalainen' | wikisql |
CREATE TABLE table_6789 (
"Date" text,
"Time" text,
"Score" text,
"Set 1" text,
"Set 2" text,
"Set 3" text,
"Set 4" text,
"Total" text,
"Report" text
) | What is the Date with a Time of 17:37, and the Set 4 is 25 15? | SELECT "Date" FROM table_6789 WHERE "Time" = '17:37' AND "Set 4" = '25–15' | wikisql |
CREATE TABLE table_name_76 (
total VARCHAR,
nation VARCHAR,
rank VARCHAR
) | What is the total medals Austria and those with larger than rank 4 have? | SELECT COUNT(total) FROM table_name_76 WHERE nation = "austria" AND rank > 4 | sql_create_context |
CREATE TABLE table_67613 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Decision" text,
"Attendance" real,
"Record" text
) | Name the visitor for october 19 | SELECT "Visitor" FROM table_67613 WHERE "Date" = 'october 19' | wikisql |
CREATE TABLE table_53069 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What was the home team score when the away team was Carlton? | SELECT "Home team score" FROM table_53069 WHERE "Away team" = 'carlton' | wikisql |
CREATE TABLE table_68223 (
"Name" text,
"Entered office" text,
"Left office" text,
"Party" text,
"First Minister" text
) | What is the party of the minister who left office on 26 November 2002? | SELECT "Party" FROM table_68223 WHERE "Left office" = '26 november 2002' | wikisql |
CREATE TABLE table_name_26 (
power__mw_ INTEGER,
voltage__kv_ VARCHAR,
country VARCHAR
) | Which Power (MW) has a Voltage (kV) of 500, and a Country of argentina? | SELECT AVG(power__mw_) FROM table_name_26 WHERE voltage__kv_ = 500 AND country = "argentina" | sql_create_context |
CREATE TABLE table_name_97 (
home_team VARCHAR,
away_team VARCHAR
) | Who was the home team in the match that had an away team of Convoy Sun Hei Team B? | SELECT home_team FROM table_name_97 WHERE away_team = "convoy sun hei team b" | sql_create_context |
CREATE TABLE table_name_22 (
position VARCHAR,
cfl_team VARCHAR
) | What position do the bc lions pick? | SELECT position FROM table_name_22 WHERE cfl_team = "bc lions" | 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 admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,... | what was the diagnosis of patient 98015 for the first time in this year? | SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT diagnoses_icd.icd9_code FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 98015) AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(C... | mimic_iii |
CREATE TABLE table_name_29 (
score_in_the_final VARCHAR,
date VARCHAR
) | What was the final score for the August 25, 1996 match? | SELECT score_in_the_final FROM table_name_29 WHERE date = "august 25, 1996" | sql_create_context |
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CRE... | Make sense of the acronym answers. | (SELECT Id AS "post_link" FROM Posts WHERE ParentId = @TargetPost) | sede |
CREATE TABLE table_train_102 (
"id" int,
"autoimmune_disease" bool,
"stroke" bool,
"renal_disease" bool,
"hepatic_disease" bool,
"liver_disease" bool,
"serum_creatinine" float,
"seizure_disorder" bool,
"NOUSE" float
) | active liver disease | SELECT * FROM table_train_102 WHERE liver_disease = 1 | criteria2sql |
CREATE TABLE table_name_36 (
fourth_place VARCHAR,
year VARCHAR
) | Tell me fourth place for year of 2010 | SELECT fourth_place FROM table_name_36 WHERE year = 2010 | sql_create_context |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions... | provide the number of patients whose marital status is widowed and lab test name is albumin/creatinine, urine? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "WIDOWED" AND lab.label = "Albumin/Creatinine, Urine" | mimicsql_data |
CREATE TABLE table_name_64 (
score VARCHAR,
record VARCHAR
) | What was the score of the game that led to a 79-77 record? | SELECT score FROM table_name_64 WHERE record = "79-77" | sql_create_context |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationD... | Users who self-answered with a score of < 0. possibly newbies who don't know what they are doing | SELECT q.Id AS "post_link" FROM Posts AS q JOIN Users AS u ON q.OwnerUserId = u.Id JOIN Posts AS a ON q.Id = a.ParentId AND q.OwnerUserId = a.OwnerUserId WHERE a.Score < 0 AND q.AcceptedAnswerId != a.Id AND u.Reputation < 15 ORDER BY a.CreationDate DESC | sede |
CREATE TABLE table_43092 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" text
) | Who was the opponent on December 18, 2005? | SELECT "Opponent" FROM table_43092 WHERE "Date" = 'december 18, 2005' | wikisql |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text,
person_info_CSD text,
person_info_CSRQ time,
person_info_GJDM text,
person_info_GJMC text,
person_info_JGDM text,
person_info_JGMC text,
person_info_MZDM text,
person_info_MZMC text,
person_info_XBDM ... | 叫做褚昊天的病号在医院2197506中入院时的住院就诊记录里科室名称不包含眼外伤各是哪几条? | SELECT * FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE hz_info.person_info_XM = '褚昊天' AND hz_info.YLJGDM = '2197506' AND NOT zyjzjlb.JZKSMC LIKE '%眼外伤%' | css |
CREATE TABLE schedule (
Cinema_ID int,
Film_ID int,
Date text,
Show_times_per_day int,
Price float
)
CREATE TABLE cinema (
Cinema_ID int,
Name text,
Openning_year int,
Capacity int,
Location text
)
CREATE TABLE film (
Film_ID int,
Rank_in_series int,
Number_in_seaso... | Plot sum capacity over openning year in a line chart, I want to display by the X in descending. | SELECT Openning_year, SUM(Capacity) FROM cinema ORDER BY Openning_year DESC | 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
) | Just list the name and price of its most expensive product in a bar chart, and show in ascending by the Y. | SELECT T1.Name, MAX(T1.Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY MAX(T1.Price) | nvbench |
CREATE TABLE flight_fare (
flight_id int,
fare_id int
)
CREATE TABLE food_service (
meal_code text,
meal_number int,
compartment text,
meal_description varchar
)
CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE days (
days_code varchar,
day_name varchar
)
... | what flights does DL have between BOSTON and SAN FRANCISCO | 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 requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
... | Prof. Catherine Sanok teaches what other courses besides 468 ? | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.number <> 468 AND instructor.name LIKE '%Catherine Sanok%' AND offering_instructor.instructor_id = instructor.instructor_id AND offeri... | advising |
CREATE TABLE table_47523 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" text
) | What was the attendance for the game in Week 3? | SELECT "Attendance" FROM table_47523 WHERE "Week" = '3' | wikisql |
CREATE TABLE t_kc21 (
MED_CLINIC_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
COMP_ID text,
PERSON_ID text,
PERSON_NM text,
IDENTITY_CARD text,
SOC_SRT_CARD text,
PERSON_SEX number,
PERSON_AGE number,
IN_HOSP_DATE time,
OUT_HOSP_DATE time,
DIFF_PLACE_FLG numb... | 在整个医疗记录中医院编号3850390的住院诊断为躁狂抑郁性精神病当前为抑郁相的人花的最低和最高医疗费总额是多少元? | SELECT MIN(MED_AMOUT), MAX(MED_AMOUT) FROM t_kc24 WHERE MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc21 WHERE MED_SER_ORG_NO = '3850390' AND IN_DIAG_DIS_NM = '躁狂抑郁性精神病当前为抑郁相') | css |
CREATE TABLE time_slot (
time_slot_id varchar(4),
day varchar(1),
start_hr numeric(2),
start_min numeric(2),
end_hr numeric(2),
end_min numeric(2)
)
CREATE TABLE course (
course_id varchar(8),
title varchar(50),
dept_name varchar(20),
credits numeric(2,0)
)
CREATE TABLE classro... | How many rooms in each building have a capacity of over 50 Visualize by bar chart, and sort by the total number in asc. | SELECT building, COUNT(*) FROM classroom WHERE capacity > 50 GROUP BY building ORDER BY COUNT(*) | nvbench |
CREATE TABLE table_name_36 (
record VARCHAR,
time VARCHAR,
opponent VARCHAR
) | What was the record when matt grice fought dennis bermudez with a time of 5:00? | SELECT record FROM table_name_36 WHERE time = "5:00" AND opponent = "dennis bermudez" | sql_create_context |
CREATE TABLE table_72190 (
"Year" real,
"Championship" text,
"54 holes" text,
"Winning score" text,
"Margin" text,
"Runner(s)-up" text
) | who is the runner(s)-up where 54 holes is tied for lead and margin is 5 strokes | SELECT "Runner(s)-up" FROM table_72190 WHERE "54 holes" = 'Tied for lead' AND "Margin" = '5 strokes' | wikisql |
CREATE TABLE table_10413597_5 (
written_by VARCHAR,
setting VARCHAR
) | Who wrote the episode that was set in winter 1541/february 13, 1542? | SELECT written_by FROM table_10413597_5 WHERE setting = "Winter 1541/February 13, 1542" | sql_create_context |
CREATE TABLE table_train_101 (
"id" int,
"systolic_blood_pressure_sbp" int,
"uncontrolled_diabetes" bool,
"hemoglobin_a1c_hba1c" float,
"allergy_to_contrast_agent_gadolinium" bool,
"diastolic_blood_pressure_dbp" int,
"hypotension" bool,
"hypertension" bool,
"NOUSE" float
) | allergy to the contrast agent gadolinium | SELECT * FROM table_train_101 WHERE allergy_to_contrast_agent_gadolinium = 1 | criteria2sql |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number... | in the last year, when did patient 16066 come for the first time to the hospital? | SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 16066 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY admissions.admittime LIMIT 1 | mimic_iii |
CREATE TABLE table_name_80 (
team VARCHAR,
losses VARCHAR,
goals_for VARCHAR
) | Which team had 7 losses and 55 goals? | SELECT team FROM table_name_80 WHERE losses = "7" AND goals_for = 55 | sql_create_context |
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
C... | Find meta requests/bugs there were declined or completed more than once. | SELECT PostId AS "post_link", COUNT(PostId) AS RevisionCount FROM PostHistory WHERE 'comment' = 'edited tags' AND ('text' LIKE '%<status-completed>%' OR 'text' LIKE '%<status-declined>%') GROUP BY PostId HAVING COUNT(PostId) > 1 ORDER BY COUNT(PostId) DESC LIMIT 100 | sede |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions... | how many patients whose primary disease is atrial fibrillation\thoracoscopic maze procedure bilateral/sda and age is less than 68? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ATRIAL FIBRILLATION\THORACOSCOPIC MAZE PROCEDURE BILATERAL/SDA" AND demographic.age < "68" | mimicsql_data |
CREATE TABLE employees (
id number,
last_name text,
first_name text,
title text,
reports_to number,
birth_date time,
hire_date time,
address text,
city text,
state text,
country text,
postal_code text,
phone text,
fax text,
email text
)
CREATE TABLE invoice_l... | What are the titles of all the Aerosmith albums? | SELECT T1.title FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = "Aerosmith" | spider |
CREATE TABLE pitStops (
raceId INTEGER,
driverId INTEGER,
stop INTEGER,
lap INTEGER,
time TEXT,
duration TEXT,
milliseconds INTEGER
)
CREATE TABLE driverStandings (
driverStandingsId INTEGER,
raceId INTEGER,
driverId INTEGER,
points REAL,
position INTEGER,
positionTe... | Show me a bar chart about the number of races held in each year after 2014, and I want to display from low to high by the the number of year please. | SELECT year, COUNT(year) FROM races AS T1 JOIN results AS T2 ON T1.raceId = T2.raceId WHERE T1.year > 2014 ORDER BY COUNT(year) | nvbench |
CREATE TABLE table_64116 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
) | Who was the opponent on september 10, 1979? | SELECT "Opponent" FROM table_64116 WHERE "Date" = 'september 10, 1979' | wikisql |
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, a bar chart shows the distribution of name and the sum of revenue , and group by attribute name, and sort by the x axis from high to low. | SELECT T2.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name DESC | nvbench |
CREATE TABLE table_44775 (
"1950" real,
"General 1950" text,
"Senate 1950" text,
"House 1950" text,
"Governors 1950" text
) | What shows for House 1950 when the Governors 1950 show governors 1995? | SELECT "House 1950" FROM table_44775 WHERE "Governors 1950" = 'governors 1995' | wikisql |
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
Last... | What are the most popular tags.. | SELECT TagName, 'Count' FROM Tags ORDER BY 'Count' DESC | sede |
CREATE TABLE film (
film_id number,
rank_in_series number,
number_in_season number,
title text,
directed_by text,
original_air_date text,
production_code text
)
CREATE TABLE schedule (
cinema_id number,
film_id number,
date text,
show_times_per_day number,
price number
)... | Who are all the directors? | SELECT DISTINCT directed_by FROM film | spider |
CREATE TABLE table_204_174 (
id number,
"rank" number,
"name" text,
"nationality" text,
"result" number,
"notes" text
) | who is at the top ? | SELECT "name" FROM table_204_174 WHERE id = 1 | squall |
CREATE TABLE classroom (
building varchar(15),
room_number varchar(7),
capacity numeric(4,0)
)
CREATE TABLE course (
course_id varchar(8),
title varchar(50),
dept_name varchar(20),
credits numeric(2,0)
)
CREATE TABLE section (
course_id varchar(8),
sec_id varchar(8),
semester v... | Show how many courses in 2008 for every instructor with a bar chart. | SELECT name, COUNT(name) FROM course AS T1 JOIN teaches AS T2 ON T1.course_id = T2.course_id JOIN instructor AS T3 ON T2.ID = T3.ID WHERE year = 2008 GROUP BY name | nvbench |
CREATE TABLE table_name_8 (
wins INTEGER,
losses VARCHAR,
pct VARCHAR,
rank VARCHAR
) | What is the lowest amount of wins a manager with more than 0.526 pct., ranked higher than 37, and 947 losses has? | SELECT MIN(wins) FROM table_name_8 WHERE pct > 0.526 AND rank < 37 AND losses = 947 | sql_create_context |
CREATE TABLE table_51741 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | Hows many Laps are in a Grid of 4? | SELECT COUNT("Laps") FROM table_51741 WHERE "Grid" = '4' | wikisql |
CREATE TABLE table_79176 (
"Player" text,
"Country" text,
"Year(s) won" real,
"Total" real,
"To par" text,
"Finish" text
) | What is the to par when the year(s) won is larger than 1999? | SELECT "To par" FROM table_79176 WHERE "Year(s) won" > '1999' | wikisql |
CREATE TABLE table_name_19 (
silver INTEGER,
bronze VARCHAR,
gold VARCHAR,
total VARCHAR
) | Gold of 1, and a Total smaller than 4, and a Bronze smaller than 0 has the lowest silver? | SELECT MIN(silver) FROM table_name_19 WHERE gold = 1 AND total < 4 AND bronze < 0 | sql_create_context |
CREATE TABLE table_11951237_4 (
title VARCHAR,
original_air_date VARCHAR
) | Which tittles have an original air date of March 19, 1998 | SELECT title FROM table_11951237_4 WHERE original_air_date = "March 19, 1998" | sql_create_context |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
CREATE TABLE jybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH text,
BGJGDM text,
BGJGMC text,
BGRGH text,
BGRQ time,
BGRXM text,
BGSJ time,
CJRQ time,
JSBBRQSJ time,
... | 在17年3月21日到18年10月30日期间,患者12922014曾到医院看过几次病 | SELECT (SELECT COUNT(*) FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE hz_info.RYBH = '12922014' AND mzjzjlb.JZKSRQ BETWEEN '2017-03-21' AND '2018-10-30') + (SELECT COUNT(*) FROM hz_info JOIN zyjzjlb JOIN hz_info_zyjzjlb ON hz_info.YLJGDM = h... | css |
CREATE TABLE table_name_32 (
opponent VARCHAR,
date VARCHAR
) | Who was the opponent that played on may 12? | SELECT opponent FROM table_name_32 WHERE date = "may 12" | sql_create_context |
CREATE TABLE savings (
custid number,
balance number
)
CREATE TABLE accounts (
custid number,
name text
)
CREATE TABLE checking (
custid number,
balance number
) | What are the names of accounts with checking balances greater than the average checking balance and savings balances below the average savings balance? | SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance > (SELECT AVG(balance) FROM checking) INTERSECT SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT AVG(balance) FROM savings) | spider |
CREATE TABLE table_9146 (
"Date" text,
"Time" text,
"Score" text,
"Set 1" text,
"Set 2" text,
"Set 3" text,
"Total" text
) | What was the overall score when the score for set 3 is 21 25? | SELECT "Score" FROM table_9146 WHERE "Set 3" = '21–25' | 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... | What is the relationship between Team_ID and All_Games_Percent , and group by attribute ACC_Regular_Season? | SELECT Team_ID, All_Games_Percent FROM basketball_match GROUP BY ACC_Regular_Season | nvbench |
CREATE TABLE table_61662 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Game site" text,
"Record" text,
"Attendance" real
) | What was the record when the Denver Broncos played the New York Titans at Bears Stadium? | SELECT "Record" FROM table_61662 WHERE "Game site" = 'bears stadium' AND "Opponent" = 'new york titans' | wikisql |
CREATE TABLE table_29625 (
"Game" real,
"December" real,
"Opponent" text,
"Score" text,
"Location/Attendance" text,
"Record" text,
"Points" real
) | How many games were played against a team with a 9-19-6 record against the Islanders? | SELECT COUNT("December") FROM table_29625 WHERE "Record" = '9-19-6' | wikisql |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid num... | what was the name of the output, which patient 005-18714 had last on 07/21/last year? | SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-18714')) AND intakeoutput.cellpath LIKE '%output%' AND D... | eicu |
CREATE TABLE rating (
rid number,
mid number,
stars number,
ratingdate time
)
CREATE TABLE movie (
mid number,
title text,
year number,
director text
)
CREATE TABLE reviewer (
rid number,
name text
) | For each director, what is the title and score of their most poorly rated movie? | SELECT T2.title, T1.stars, T2.director, MIN(T1.stars) FROM rating AS T1 JOIN movie AS T2 ON T1.mid = T2.mid GROUP BY T2.director | spider |
CREATE TABLE table_name_90 (
outcome VARCHAR,
score VARCHAR
) | Which Outcome has a Score of 3 6 2 6? | SELECT outcome FROM table_name_90 WHERE score = "3–6 2–6" | sql_create_context |
CREATE TABLE table_24912 (
"Team" text,
"Outgoing manager" text,
"Manner of departure" text,
"Date of vacancy" text,
"Replaced by" text,
"Date of appointment" text
) | Who was the replacement manager for the vacancy of 12 Dec 2009? | SELECT "Replaced by" FROM table_24912 WHERE "Date of vacancy" = '12 Dec 2009' | wikisql |
CREATE TABLE table_name_42 (
date VARCHAR,
catalog VARCHAR
) | What was the date for the catalog 32xa-112? | SELECT date FROM table_name_42 WHERE catalog = "32xa-112" | sql_create_context |
CREATE TABLE table_train_171 (
"id" int,
"systolic_blood_pressure_sbp" int,
"hiv_infection" bool,
"hemoglobin_a1c_hba1c" float,
"hepatitis_c" bool,
"diastolic_blood_pressure_dbp" int,
"body_mass_index_bmi" float,
"triglyceride_tg" float,
"NOUSE" float
) | hiv or hepatitis c positive status; | SELECT * FROM table_train_171 WHERE hiv_infection = 1 OR hepatitis_c = 1 | criteria2sql |
CREATE TABLE table_38218 (
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text
) | What is the date of the match with a result of 4-0? | SELECT "Date" FROM table_38218 WHERE "Result" = '4-0' | wikisql |
CREATE TABLE table_name_33 (
district VARCHAR,
party VARCHAR,
first_elected VARCHAR
) | In which district is the incumbent a republican first elected in 1998? | SELECT district FROM table_name_33 WHERE party = "republican" AND first_elected = 1998 | sql_create_context |
CREATE TABLE table_name_35 (
class VARCHAR,
call_sign VARCHAR
) | \What is the class of the station with the call sign w254ah? | SELECT class FROM table_name_35 WHERE call_sign = "w254ah" | sql_create_context |
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total_gpa float,
entered_as varchar,
admit_term int,
predicted_graduation_semester int,
degree varchar,
minor varchar,
internship varch... | Do you know anywhere that offers intelligent systems courses ? | SELECT DISTINCT course.department, course.name, course.number FROM area, course WHERE area.area LIKE '%intelligent systems%' AND course.course_id = area.course_id | advising |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,... | since 12/2104, what was the daily minimum value of the pt of patient 31854? | SELECT MIN(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 31854) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'pt') AND STRFTIME('%y-%m', labevents.charttime) >= '2104-12' GROUP BY STRFT... | mimic_iii |
CREATE TABLE table_name_31 (
vuelta_wins VARCHAR,
country VARCHAR,
points VARCHAR
) | How many times is the country ireland and points more than 4? | SELECT COUNT(vuelta_wins) FROM table_name_31 WHERE country = "ireland" AND points > 4 | sql_create_context |
CREATE TABLE table_11734041_10 (
player VARCHAR,
height_in_ft VARCHAR
) | What are all the names of the players who are 7-0 tall? | SELECT player FROM table_11734041_10 WHERE height_in_ft = "7-0" | sql_create_context |
CREATE TABLE table_14005 (
"Position" real,
"Team" text,
"Played" real,
"Wins" real,
"Draws" real,
"Losses" real,
"Scored" real,
"Conceded" real,
"Points" real
) | How many points are in the scored category for the team that has less than 5 draws, 8 total wins, and total overall points less than 27? | SELECT COUNT("Scored") FROM table_14005 WHERE "Draws" < '5' AND "Wins" = '8' AND "Points" < '27' | wikisql |
CREATE TABLE table_71807 (
"Rank" real,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | How many golds have a Total of 11, and a Bronze smaller than 3? | SELECT SUM("Gold") FROM table_71807 WHERE "Total" = '11' AND "Bronze" < '3' | 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... | provide the number of patients whose admission type is emergency and diagnosis long title is other specified disorders of esophagus | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.long_title = "Other specified disorders of esophagus" | mimicsql_data |
CREATE TABLE table_68259 (
"Year" text,
"Position" text,
"League" text,
"FA Cup" text,
"Malaysia Cup" text
) | What is the position when the League is the malaysian super league, and a Year of 2011? | SELECT "Position" FROM table_68259 WHERE "League" = 'malaysian super league' AND "Year" = '2011' | wikisql |
CREATE TABLE table_name_55 (
years VARCHAR,
win_loss VARCHAR
) | What is Years, when Win-Loss is 11-60? | SELECT years FROM table_name_55 WHERE win_loss = "11-60" | sql_create_context |
CREATE TABLE table_name_91 (
team_2 VARCHAR
) | What is the 1st leg when team 2 is Asil Lysi? | SELECT 1 AS st_leg FROM table_name_91 WHERE team_2 = "asil lysi" | sql_create_context |
CREATE TABLE guests (
guest_id number,
gender_code text,
guest_first_name text,
guest_last_name text,
date_of_birth time
)
CREATE TABLE apartments (
apt_id number,
building_id number,
apt_type_code text,
apt_number text,
bathroom_count number,
bedroom_count number,
room_... | Show the first names and last names of all the guests that have apartment bookings with status code 'Confirmed'. | SELECT T2.guest_first_name, T2.guest_last_name FROM apartment_bookings AS T1 JOIN guests AS T2 ON T1.guest_id = T2.guest_id WHERE T1.booking_status_code = "Confirmed" | spider |
CREATE TABLE table_name_77 (
competition VARCHAR,
event VARCHAR,
time VARCHAR
) | What Competition has an Event of 4x100 m relay and has the Time of 38.89? | SELECT competition FROM table_name_77 WHERE event = "4x100 m relay" AND time = "38.89" | sql_create_context |
CREATE TABLE table_name_92 (
netflix VARCHAR,
episode VARCHAR,
segment_d VARCHAR
) | Which Netflix episode has an overall episode number under 69 and a Segment D of S Trombone? | SELECT netflix FROM table_name_92 WHERE episode < 69 AND segment_d = "s trombone" | sql_create_context |
CREATE TABLE table_57453 (
"Date" text,
"Tournament" text,
"Location" text,
"Purse( $ )" real,
"Winner" text,
"Score" text,
"1st Prize( $ )" real
) | Tell me the average 1st prize for tennessee | SELECT AVG("1st Prize( $ )") FROM table_57453 WHERE "Location" = 'tennessee' | wikisql |
CREATE TABLE table_79862 (
"Round" real,
"Pick #" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
) | College of lsu has how many rounds? | SELECT COUNT("Round") FROM table_79862 WHERE "College" = 'lsu' | wikisql |
CREATE TABLE table_11706 (
"Date" text,
"Course" text,
"Distance" text,
"Type" text,
"Winner" text
) | Which course had a mountain stage type on 3 June? | SELECT "Course" FROM table_11706 WHERE "Type" = 'mountain stage' AND "Date" = '3 june' | wikisql |
CREATE TABLE table_75610 (
"Game" real,
"October" real,
"Opponent" text,
"Score" text,
"Record" text
) | Which game has the highest score in October with 9? | SELECT MAX("October") FROM table_75610 WHERE "Game" = '9' | wikisql |
CREATE TABLE table_name_3 (
round INTEGER,
player VARCHAR
) | What lowest round has orlando pace as the player? | SELECT MIN(round) FROM table_name_3 WHERE player = "orlando pace" | sql_create_context |
CREATE TABLE Student (
StuID VARCHAR,
Fname VARCHAR,
Lname VARCHAR
)
CREATE TABLE Sportsinfo (
StuID VARCHAR
) | Show total hours per week and number of games played for student David Shieber. | SELECT SUM(hoursperweek), SUM(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Fname = "David" AND T2.Lname = "Shieber" | sql_create_context |
CREATE TABLE table_203_692 (
id number,
"name" text,
"pos." text,
"caps" number,
"goals" number,
"club" text
) | who is the last player listed ? | SELECT "name" FROM table_203_692 ORDER BY id DESC LIMIT 1 | squall |
CREATE TABLE table_28677723_5 (
karianne_gulliksen INTEGER
) | What is the largest number for karianne gulliksen? | SELECT MAX(karianne_gulliksen) FROM table_28677723_5 | sql_create_context |
CREATE TABLE table_name_20 (
position VARCHAR,
club_team VARCHAR
) | What position does the player from the Miami University (CCHA) club team play? | SELECT position FROM table_name_20 WHERE club_team = "miami university (ccha)" | sql_create_context |
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... | how many patients were prescribed hydromorphone within 2 months during this year after the diagnosis with congestive heart failure? | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'congestive heart failure' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), ... | eicu |
CREATE TABLE table_200_10 (
id number,
"year" number,
"deaths" number,
"# of accidents" number
) | which year was responsible for 4,140 deaths ? | SELECT "year" FROM table_200_10 WHERE "deaths" = 4140 | 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,... | find the number of divorced patients who have blood gas lab test category. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "DIVORCED" AND lab."CATEGORY" = "Blood Gas" | mimicsql_data |
CREATE TABLE table_2917 (
"Artist" text,
"Song (English translation)" text,
"Songwriter(s)" text,
"Position" real,
"Date Eliminated" text
) | What is the position of the song thar genjor mcnell performed? | SELECT "Position" FROM table_2917 WHERE "Artist" = 'Genjor McNell' | wikisql |
CREATE TABLE staff (
staff_id number,
gender text,
first_name text,
last_name text,
email_address text,
phone_number text
)
CREATE TABLE customers (
customer_id number,
customer_type_code text,
address_line_1 text,
address_line_2 text,
town_city text,
state text,
ema... | Which city has the least number of customers whose type code is 'Good Credit Rating'? | SELECT town_city FROM customers WHERE customer_type_code = "Good Credit Rating" GROUP BY town_city ORDER BY COUNT(*) LIMIT 1 | spider |
CREATE TABLE table_36764 (
"Outcome" text,
"Date" text,
"Tournament" text,
"Surface" text,
"Opponent" text,
"Score" text
) | Which Surface has a Score of 6 4, 6 2? | SELECT "Surface" FROM table_36764 WHERE "Score" = '6–4, 6–2' | wikisql |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost numbe... | show me the top three most common output events until 2101? | SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%output%' AND STRFTIME('%y', intakeoutput.intakeoutputtime) <= '2101' GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 3 | eicu |
CREATE TABLE table_36555 (
"School Year" text,
"Class A" text,
"Class AA" text,
"Class AAA" text,
"Class AAAA" text,
"Class AAAAA" text
) | what AAA class has a school year of 1989-90? | SELECT "Class AAA" FROM table_36555 WHERE "School Year" = '1989-90' | wikisql |
CREATE TABLE Aircraft (
name VARCHAR,
distance VARCHAR,
aid VARCHAR
) | What is the name and distance for aircraft with id 12? | SELECT name, distance FROM Aircraft WHERE aid = 12 | 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... | give the number of patients whose admission location is phys referral/normal deli and drug code is baci15o. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND prescriptions.formulary_drug_cd = "BACI15O" | mimicsql_data |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.