table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE table_71198 (
"Res." text,
"Record" text,
"Opponent" text,
"Method" text,
"Event" text,
"Round" real,
"Time" text,
"Location" text
) | Which opponent has a Time of 1:34? | SELECT "Opponent" FROM table_71198 WHERE "Time" = '1:34' |
CREATE TABLE PostsWithDeleted (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
ViewCount number,
Body text,
OwnerUserId number,
OwnerDisplayName text,
LastEditorUserId number,
LastEditorDispl... | TOP 50 users from Michigan. Lists the top 50 users (ranked by reputation) that are located in Calicut/Kozhikode, Kerala, India according to their profile information.
Thanks to http://data.stackexchange.com/stackoverflow/qe/1157/top-100-users-from-greece | SELECT Id, DisplayName, Reputation, WebsiteUrl, Location FROM Users WHERE Location LIKE '%Michigan%' ORDER BY Reputation DESC LIMIT 150 |
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,... | give me the number of patients who had endoscopic excision or destruction of lesion or tissue of stomach and were hospitalized for more than 13 days. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "13" AND procedures.short_title = "Endosc destr stomach les" |
CREATE TABLE table_25080 (
"Year" real,
"Network" text,
"Race caller" text,
"s Host" text,
"s Analyst" text,
"Reporters" text,
"Trophy presentation" text
) | Who is the race caller when jim mckay and al michaels were s hosts in the year 1987? | SELECT "Race caller" FROM table_25080 WHERE "s Host" = 'Jim McKay and Al Michaels' AND "Year" = '1987' |
CREATE TABLE department (
dept_name VARCHAR
) | list names of all departments ordered by their names. | SELECT dept_name FROM department ORDER BY dept_name |
CREATE TABLE table_name_79 (
grid VARCHAR,
time_retired VARCHAR
) | what is the grid when the time/retired is +27.112? | SELECT grid FROM table_name_79 WHERE time_retired = "+27.112" |
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 intakeoutput (
intakeoutputid numb... | among the patients of age 40s a year before, what was the top three most frequent procedure? | SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 40 AND 49) AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT... |
CREATE TABLE table_39669 (
"Date" text,
"Time" text,
"Visitor" text,
"Score" text,
"Home" text,
"Location/Attendance" text,
"Record" text
) | Who was the visitor at the pittsburgh penguins at 7:00 pm that had a record of 0-2-2? | SELECT "Visitor" FROM table_39669 WHERE "Home" = 'pittsburgh penguins' AND "Time" = '7:00 pm' AND "Record" = '0-2-2' |
CREATE TABLE table_name_8 (
result VARCHAR,
date VARCHAR
) | What was the score of the game on November 22? | SELECT result FROM table_name_8 WHERE date = "november 22" |
CREATE TABLE table_203_629 (
id number,
"year" number,
"title" text,
"lead vocalist" text,
"aria chart position" number,
"album" text
) | who was the lead vocalist in sweat it out ? | SELECT "lead vocalist" FROM table_203_629 WHERE "title" = '"sweat it out"' |
CREATE TABLE table_name_94 (
partner VARCHAR,
opponents_in_the_final VARCHAR
) | Who was the partner that played against Serena Williams Venus Williams? | SELECT partner FROM table_name_94 WHERE opponents_in_the_final = "serena williams venus williams" |
CREATE TABLE course_offering (
offering_id int,
course_id int,
semester int,
section_number int,
start_time time,
end_time time,
monday varchar,
tuesday varchar,
wednesday varchar,
thursday varchar,
friday varchar,
saturday varchar,
sunday varchar,
has_final_proje... | Which one is easier EECS 532 or EECS 481 ? | SELECT DISTINCT course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (course.number = 532 OR course.number = 481) AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 INNER JOIN course AS COURSEalias1 ON ... |
CREATE TABLE table_name_3 (
episode_title VARCHAR,
prod_code VARCHAR
) | What was the title of the episode with a production code of 1gowo04? | SELECT episode_title FROM table_name_3 WHERE prod_code = "1gowo04" |
CREATE TABLE table_name_83 (
opening VARCHAR,
result VARCHAR,
white VARCHAR,
moves VARCHAR
) | What's the opening when white is Anand with fewer than 61 moves for a result of ? | SELECT opening FROM table_name_83 WHERE white = "anand" AND moves < 61 AND result = "½–½" |
CREATE TABLE Residents_Services (
resident_id INTEGER,
service_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255)
)
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER,
Date_and_Time DATETIME,
... | List the number of items by the details of the organization that owns it using a bar chart, rank in ascending by the organization_details. | SELECT organization_details, COUNT(organization_details) FROM Things AS T1 JOIN Organizations AS T2 ON T1.organization_id = T2.organization_id GROUP BY organization_details ORDER BY organization_details |
CREATE TABLE stock (
shop_id number,
device_id number,
quantity number
)
CREATE TABLE device (
device_id number,
device text,
carrier text,
package_version text,
applications text,
software_platform text
)
CREATE TABLE shop (
shop_id number,
shop_name text,
location tex... | What is the name of the shop that has the most different kinds of devices in stock? | SELECT T2.shop_name FROM stock AS T1 JOIN shop AS T2 ON T1.shop_id = T2.shop_id GROUP BY T1.shop_id ORDER BY COUNT(*) DESC LIMIT 1 |
CREATE TABLE table_4985 (
"Res." text,
"Record" text,
"Opponent" text,
"Method" text,
"Event" text,
"Round" real,
"Time" text,
"Location" text
) | Who did he fight in Rumble of the Kings 6? | SELECT "Opponent" FROM table_4985 WHERE "Event" = 'rumble of the kings 6' |
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... | get me the number of patients born before 2107 who have coronary artery primary disease. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE" AND demographic.dob_year < "2107" |
CREATE TABLE table_name_65 (
film_title_used_in_nomination VARCHAR,
original_title VARCHAR
) | What is the film title used for nomination with the original title sedamdeset i dva dana? | SELECT film_title_used_in_nomination FROM table_name_65 WHERE original_title = "sedamdeset i dva dana" |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | Top 10 Users from. | SELECT Id, DisplayName, Reputation FROM Users ORDER BY Reputation DESC LIMIT 10 |
CREATE TABLE table_2140071_10 (
season VARCHAR,
premier_date VARCHAR
) | Name the season for august 16, 2010 | SELECT season FROM table_2140071_10 WHERE premier_date = "August 16, 2010" |
CREATE TABLE table_name_13 (
played INTEGER,
lost VARCHAR,
drawn VARCHAR
) | What Played has a Lost smaller than 3, and a Drawn smaller than 0? | SELECT AVG(played) FROM table_name_13 WHERE lost < 3 AND drawn < 0 |
CREATE TABLE table_9516 (
"Party" text,
"Leader" text,
"Seats" text,
"% of seats" text,
"First Pref votes" text,
"% FPv" text
) | What is the First Pref Votes for the % FPv of 0.06? | SELECT "First Pref votes" FROM table_9516 WHERE "% FPv" = '0.06' |
CREATE TABLE table_77106 (
"Tournament" text,
"1989" text,
"1990" text,
"1991" text,
"1992" text,
"1993" text,
"1994" text,
"1995" text,
"1996" text,
"1997" text,
"1998" text,
"1999" text,
"2000" text,
"2001" text,
"2002" text,
"2003" text,
"Career SR"... | What was the value in 1989 with QF in 1997 and A in 1993? | SELECT "1989" FROM table_77106 WHERE "1997" = 'qf' AND "1993" = 'a' |
CREATE TABLE program_course (
program_id int,
course_id int,
workload int,
category varchar
)
CREATE TABLE student_record (
student_id int,
course_id int,
semester int,
grade varchar,
how varchar,
transfer_source varchar,
earn_credit varchar,
repeat_term varchar,
tes... | How difficult on average are the PreMajor classes ? | SELECT AVG(workload) FROM program_course WHERE category LIKE '%PreMajor%' |
CREATE TABLE Customers (
customer_id INTEGER,
payment_method VARCHAR(15),
customer_name VARCHAR(80),
date_became_customer DATETIME,
other_customer_details VARCHAR(255)
)
CREATE TABLE Customer_Orders (
order_id INTEGER,
customer_id INTEGER,
order_status VARCHAR(15),
order_date DATETI... | How many orders in each day? Return a bar chart to show. | SELECT order_date, COUNT(order_date) FROM Customers AS t1 JOIN Customer_Orders AS t2 ON t1.customer_id = t2.customer_id WHERE order_status = "Delivered" |
CREATE TABLE table_name_45 (
time INTEGER,
athlete VARCHAR
) | What is the athlete muna lee lowest time? | SELECT MIN(time) FROM table_name_45 WHERE athlete = "muna lee" |
CREATE TABLE table_name_93 (
combined VARCHAR,
overall VARCHAR,
slalom VARCHAR
) | What is the combined of 2 overalls and 5 slaloms? | SELECT combined FROM table_name_93 WHERE overall = "2" AND slalom = "5" |
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0... | For those employees who was hired before 2002-06-21, visualize a line chart about the change of department_id over hire_date , and could you list in descending by the X-axis? | SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY HIRE_DATE DESC |
CREATE TABLE table_name_40 (
alternate_title_translation VARCHAR,
series_premiere VARCHAR
) | What is the alternate title/translation of the series that premiered on December 12, 2006? | SELECT alternate_title_translation FROM table_name_40 WHERE series_premiere = "december 12, 2006" |
CREATE TABLE table_28964 (
"Detailed Family Information" text,
"From" real,
"To" real,
"Anchor" real,
"Orientation" text,
"Conserved in Mus Musculus" text,
"Matrix Sim" text,
"Sequence" text,
"Occurrence" real
) | What occurence has 0.925 listed as the matrix sim? | SELECT MAX("Occurrence") FROM table_28964 WHERE "Matrix Sim" = '0.925' |
CREATE TABLE table_63273 (
"Rank" real,
"Heat" real,
"Lane" real,
"Name" text,
"Nationality" text,
"Time" text
) | When the nationality is united states, and the time is 58.06, and the heat is larger than 5 what is the lowest rank? | SELECT MIN("Rank") FROM table_63273 WHERE "Nationality" = 'united states' AND "Time" = '58.06' AND "Heat" > '5' |
CREATE TABLE table_21535453_1 (
source VARCHAR,
terry_mcauliffe VARCHAR,
dates_administered VARCHAR
) | What was the source of the poll that gave McAuliffe 30% on June 8? | SELECT source FROM table_21535453_1 WHERE terry_mcauliffe = "30%" AND dates_administered = "June 8" |
CREATE TABLE table_54539 (
"Pick #" real,
"Player" text,
"Nationality" text,
"Position" text,
"League from" text
) | What nationality is Steven Anthony? | SELECT "Nationality" FROM table_54539 WHERE "Player" = 'steven anthony' |
CREATE TABLE table_27316 (
"Region" text,
"Preschool (0\u20135 years)" text,
"Primary (6\u201313 years)" text,
"Secondary (14\u201317 years)" text,
"Tertiary (18\u201324 years)" text
) | What is the enrollment ratio in preschool in the region where the enrollment ratio in primary is 93.10? | SELECT "Preschool (0\u20135 years)" FROM table_27316 WHERE "Primary (6\u201313 years)" = '93.10' |
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE student_record (
student_id int,
course_id int,
semester int,
grade varchar,
how varchar,
transfer_source varchar,
earn_credit varchar,
repeat_term varchar,
test_id varchar
)
CREATE TABLE requirement (... | Are there any classes about Elementary African Languages ? | SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%Elementary African Languages%' OR name LIKE '%Elementary African Languages%') AND department = 'EECS' |
CREATE TABLE table_38331 (
"Year" text,
"Coach" text,
"Crew" text,
"Record" text,
"Win %" real
) | Which year's crew is varsity 8+ when the record is 7-3? | SELECT "Year" FROM table_38331 WHERE "Crew" = 'varsity 8+' AND "Record" = '7-3' |
CREATE TABLE table_name_37 (
visitor VARCHAR,
date VARCHAR
) | What visitor has February 11 as the date? | SELECT visitor FROM table_name_37 WHERE date = "february 11" |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose_val_rx text,
dose_unit_rx text,
route text
... | what is the total bill for patient 52898's hospital stay in their current hospital encounter? | SELECT SUM(cost.cost) FROM cost WHERE cost.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 52898 AND admissions.dischtime IS NULL) |
CREATE TABLE products (
product_id VARCHAR
)
CREATE TABLE Order_items (
product_id VARCHAR
) | How many products were not included in any order? | SELECT COUNT(*) FROM products WHERE NOT product_id IN (SELECT product_id FROM Order_items) |
CREATE TABLE table_12062 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | what is the most laps with a grid of 20? | SELECT MAX("Laps") FROM table_12062 WHERE "Grid" = '20' |
CREATE TABLE days (
days_code varchar,
day_name varchar
)
CREATE TABLE flight_stop (
flight_id int,
stop_number int,
stop_days text,
stop_airport text,
arrival_time int,
arrival_airline text,
arrival_flight_number int,
departure_time int,
departure_airline text,
departur... | what is the lowest fare UA charges between BOSTON and SAN FRANCISCO | SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare 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... |
CREATE TABLE table_24538587_11 (
i_o_bus VARCHAR,
brand_name__list_ VARCHAR
) | What is the i/o bus for the brand name Core i3-21xx? | SELECT i_o_bus FROM table_24538587_11 WHERE brand_name__list_ = "Core i3-21xx" |
CREATE TABLE table_54822 (
"Rank" text,
"Name" text,
"Height m (ft)" text,
"Floors" real,
"Year" real
) | What is the name of the building housing more than 101 floors, that was built after 2006? | SELECT "Name" FROM table_54822 WHERE "Year" > '2006' AND "Floors" > '101' |
CREATE TABLE table_name_34 (
against INTEGER,
losses VARCHAR,
byes VARCHAR
) | What is the total number of against when they had 14 losses and more than 0 byes? | SELECT SUM(against) FROM table_name_34 WHERE losses = 14 AND byes > 0 |
CREATE TABLE table_name_13 (
score VARCHAR,
country VARCHAR
) | What did the golfer from Australia score? | SELECT score FROM table_name_13 WHERE country = "australia" |
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... | List of all tagnames (each with one post). | SELECT t.TagName, MIN(q.Id) AS "post_link" FROM Tags AS t INNER JOIN PostTags AS pt ON t.Id = pt.TagId INNER JOIN Posts AS q ON q.Id = pt.PostId GROUP BY t.TagName ORDER BY t.TagName |
CREATE TABLE table_name_98 (
_number_of_bids VARCHAR,
conference VARCHAR
) | How many bids does Atlantic 10 have? | SELECT _number_of_bids FROM table_name_98 WHERE conference = "atlantic 10" |
CREATE TABLE table_45484 (
"Year" real,
"Australian Open" text,
"French Open" text,
"Wimbledon" text,
"US Open" text
) | What is the total number of years Andy Murray was at Wimbledon? | SELECT COUNT("Year") FROM table_45484 WHERE "Wimbledon" = 'andy murray' |
CREATE TABLE table_name_64 (
laps INTEGER,
constructor VARCHAR,
grid VARCHAR
) | What is the least number of laps for the constructor Ferrari and where the grid number was less than 4? | SELECT MIN(laps) FROM table_name_64 WHERE constructor = "ferrari" AND grid < 4 |
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)... | When will EECS 582 be offered ? | SELECT DISTINCT semester.semester, semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 582 AND course_offering.semester = semester.semester_id AND semester.semester_id > (SELECT SEMESTERalias1.semester_id FROM semeste... |
CREATE TABLE table_1208 (
"Episode No." text,
"Episode Title" text,
"UK Broadcast Date" text,
"Presenter" text,
"Countries Visited" text
) | What episode number is presented by Ben Okri ? | SELECT "Episode No." FROM table_1208 WHERE "Presenter" = 'Ben Okri' |
CREATE TABLE table_51322 (
"Episode" text,
"Air Date" text,
"Timeslot (EST)" text,
"Season" real,
"Rating" real,
"Share" real,
"18\u201349" real,
"Viewers (m)" real,
"Rank (#)" text
) | What is the average rating of viewers 18 to 49 where the total viewer count is 3.93 million and share less than 4? | SELECT AVG("18\u201349") FROM table_51322 WHERE "Viewers (m)" = '3.93' AND "Share" < '4' |
CREATE TABLE table_2668264_8 (
candidates VARCHAR,
result VARCHAR
) | Who were the candidates for election that had a result of a retired jacksonian gain? | SELECT candidates FROM table_2668264_8 WHERE result = "Retired Jacksonian gain" |
CREATE TABLE table_39340 (
"Season" real,
"Winner" text,
"Score" text,
"Runner-up" text,
"Venue" text
) | Who is the Runner-up that has a Season less than 2005? | SELECT "Runner-up" FROM table_39340 WHERE "Season" < '2005' |
CREATE TABLE table_66527 (
"Airing date" text,
"English title (Chinese title)" text,
"Number of episodes" real,
"Theme song (T) Sub-theme song (ST)" text,
"Genre" text
) | Which Airing date has a Number of episodes larger than 20, and a Genre of modern drama? | SELECT "Airing date" FROM table_66527 WHERE "Number of episodes" > '20' AND "Genre" = 'modern drama' |
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... | Show me about the distribution of All_Games and Team_ID in a bar chart, display in desc by the y-axis. | SELECT All_Games, Team_ID FROM basketball_match ORDER BY Team_ID DESC |
CREATE TABLE table_name_11 (
date_of_birth VARCHAR,
player VARCHAR
) | What is the birth date for Mervyn Dillon? | SELECT date_of_birth FROM table_name_11 WHERE player = "mervyn dillon" |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
... | what were the four most commonly given microbiology tests a year before for patients who had previously undergone packed cell transfusion within the same hospital visit? | 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, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_pro... |
CREATE TABLE table_15352 (
"Media market name" text,
"Callsign" text,
"Analog" text,
"Digital" text,
"Affiliation" text
) | what is the analog type for cw on digital 26? | SELECT "Analog" FROM table_15352 WHERE "Affiliation" = 'cw' AND "Digital" = '26' |
CREATE TABLE journal (
Journal_ID int,
Date text,
Theme text,
Sales int
)
CREATE TABLE editor (
Editor_ID int,
Name text,
Age real
)
CREATE TABLE journal_committee (
Editor_ID int,
Journal_ID int,
Work_Type text
) | Display a bar chart for the names and the ages of editors, list by the bar from low to high. | SELECT Name, Age FROM editor ORDER BY Name |
CREATE TABLE university (
School_ID int,
School text,
Location text,
Founded real,
Affiliation text,
Enrollment real,
Nickname text,
Primary_conference text
)
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Per... | Find All_Road and Team_ID , and visualize them by a bar chart. | SELECT All_Road, Team_ID FROM basketball_match |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
... | what are the top three most frequent procedures among the patients who have 20s since 3 years ago? | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age B... |
CREATE TABLE captain (
Captain_ID int,
Name text,
Ship_ID int,
age text,
Class text,
Rank text
)
CREATE TABLE Ship (
Ship_ID int,
Name text,
Type text,
Built_Year real,
Class text,
Flag text
) | How many captains with younger than 50 are in each rank. Visualize by pie chart. | SELECT Rank, COUNT(*) FROM captain WHERE age < 50 GROUP BY Rank |
CREATE TABLE table_56456 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | Which home team scored 18.11 (119)? | SELECT "Home team" FROM table_56456 WHERE "Home team score" = '18.11 (119)' |
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,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,
JOB_ID varchar(10),
... | For those employees who was hired before 2002-06-21, a line chart shows the change of manager_id over hire_date, display X-axis in descending order. | SELECT HIRE_DATE, MANAGER_ID FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY HIRE_DATE DESC |
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
... | what were the number of times patient 015-56390 produced a nephrostomy right output on the last icu visit? | SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-56390') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.uni... |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose... | count the number of times patient 27703's rbc, csf test has been taken last month. | SELECT COUNT(*) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'rbc, csf') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27703) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), ... |
CREATE TABLE table_59207 (
"Rider" text,
"Bike" text,
"Laps" real,
"Time" text,
"Grid" real
) | Name the Rider which has a Time of +59.304? | SELECT "Rider" FROM table_59207 WHERE "Time" = '+59.304' |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose... | what are the three most common drugs prescribed until 1 year ago for patients of 40s? | SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 40 AND 49) AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY pres... |
CREATE TABLE table_13981 (
"Draw" real,
"Language" text,
"Artist" text,
"Song" text,
"English translation" text,
"Place" real,
"Points" real
) | How many points does catcat have with more than 2 draws? | SELECT AVG("Points") FROM table_13981 WHERE "Artist" = 'catcat' AND "Draw" > '2' |
CREATE TABLE table_name_23 (
bowling VARCHAR,
season VARCHAR
) | What is the bowling score of season 1907? | SELECT bowling FROM table_name_23 WHERE season = "1907" |
CREATE TABLE table_name_27 (
position VARCHAR,
competition VARCHAR,
year VARCHAR
) | Which Position has a Competition of world championships, and a Year larger than 1997? | SELECT position FROM table_name_27 WHERE competition = "world championships" AND year > 1997 |
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,
JOB_ID varchar(10),
SALARY decimal(8,2),
COMMISSION_PCT decimal(2,2),
MANAGER_ID decimal(6,0),
DEPARTMENT_ID decimal(... | For those employees who did not have any job in the past, what is the relationship between salary and manager_id ? | SELECT SALARY, MANAGER_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) |
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE program (
program_id int,
name varchar,
... | What courses are required as a prerequisite to LATINOAM 204 ? | SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT... |
CREATE TABLE table_name_19 (
height__cm_ VARCHAR,
jersey__number VARCHAR,
name VARCHAR
) | How many different Heights (cm) did Mark Fusco have, when his Jersey # was less than 16? | SELECT COUNT(height__cm_) FROM table_name_19 WHERE jersey__number < 16 AND name = "mark fusco" |
CREATE TABLE table_7716 (
"Season" real,
"Overall" real,
"Slalom" text,
"Super G" real,
"Downhill" text,
"Combined" text
) | What is the highest Super G, when Season is later than 1996? | SELECT MAX("Super G") FROM table_7716 WHERE "Season" > '1996' |
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
... | what is the name of drug patient 015-1581 has been prescribed two or more times until 57 months ago? | SELECT t1.drugname FROM (SELECT medication.drugname, COUNT(medication.drugstarttime) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015... |
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... | How many students are affected by each allergy type Visualize by bar chart, order by the X-axis in ascending. | SELECT AllergyType, COUNT(*) FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy GROUP BY T2.AllergyType ORDER BY AllergyType |
CREATE TABLE table_16884579_1 (
seasons_and_winners VARCHAR,
premiere VARCHAR
) | Name the seasons and winners that airs 28 january 2007 | SELECT seasons_and_winners FROM table_16884579_1 WHERE premiere = "28 January 2007" |
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 minimum age of patients whose primary disease is gangrene and days of hospital stay is 27? | SELECT MIN(demographic.age) FROM demographic WHERE demographic.diagnosis = "GANGRENE" AND demographic.days_stay = "27" |
CREATE TABLE table_name_35 (
score VARCHAR,
december VARCHAR,
points VARCHAR,
game VARCHAR
) | Which Score has Points larger than 46, and a Game smaller than 35, and a December of 21? | SELECT score FROM table_name_35 WHERE points > 46 AND game < 35 AND december = 21 |
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_i... | what is the dose of phenylephrine hcl, that patient 12274 was first prescribed in 01/2105? | SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12274) AND prescriptions.drug = 'phenylephrine hcl' AND STRFTIME('%y-%m', prescriptions.startdate) = '2105-01' ORDER BY prescriptions.startdate LIMIT 1 |
CREATE TABLE table_203_358 (
id number,
"pos." number,
"athlete" text,
"run 1" number,
"run 2" number,
"total" text
) | how long did it take for jan urfer to complete run 2 ? | SELECT "run 2" FROM table_203_358 WHERE "athlete" = 'jan urfer' |
CREATE TABLE table_39366 (
"Game" real,
"December" real,
"Opponent" text,
"Score" text,
"Record" text
) | Which game has an opponent of Phoenix Coyotes and was before Dec 9? | SELECT AVG("Game") FROM table_39366 WHERE "Opponent" = 'phoenix coyotes' AND "December" < '9' |
CREATE TABLE table_13079788_3 (
date VARCHAR,
gt3_winner VARCHAR
) | what are all the date for gt3 winner oliver bryant matt harris | SELECT date FROM table_13079788_3 WHERE gt3_winner = "Oliver Bryant Matt Harris" |
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
CREATE TABLE event (
ID int,
Name text,
Stadium_ID int,
Year text
)
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_40... | Visualize a bar chart about the distribution of Time and meter_100 , could you display in descending by the x-axis? | SELECT Time, meter_100 FROM swimmer ORDER BY Time DESC |
CREATE TABLE table_name_31 (
original_nfl_team VARCHAR,
pos VARCHAR
) | What is the Original NFL team of the CB Player? | SELECT original_nfl_team FROM table_name_31 WHERE pos = "cb" |
CREATE TABLE table_68651 (
"Tournament" text,
"2003" text,
"2007" text,
"2008" text,
"2009" text,
"2011" text
) | What is the 2007 value with 2r in 2011 and 2r in 2008? | SELECT "2007" FROM table_68651 WHERE "2011" = '2r' AND "2008" = '2r' |
CREATE TABLE table_204_53 (
id number,
"date" text,
"result" text,
"opponent" text,
"event" text,
"location" text,
"method" text,
"round" number,
"time" text
) | how many matches were held in the netherlands ? | SELECT COUNT("event") FROM table_204_53 WHERE "location" = 'netherlands' |
CREATE TABLE table_203_860 (
id number,
"rank" number,
"city" text,
"population (2011)" number,
"population (2001)" number,
"state/territory" text
) | who is ranked before delhi ? | SELECT "city" FROM table_203_860 WHERE "rank" = (SELECT "rank" FROM table_203_860 WHERE "city" = 'delhi') - 1 |
CREATE TABLE table_name_58 (
percent_of_mass VARCHAR,
molecules VARCHAR
) | what is the perfect of mass when the molecules is 1.74e14*? | SELECT percent_of_mass FROM table_name_58 WHERE molecules = "1.74e14*" |
CREATE TABLE table_name_49 (
tournament VARCHAR,
winning_score VARCHAR
) | What Tournament had a Winning score of 6 (73-68-72-69=282)? | SELECT tournament FROM table_name_49 WHERE winning_score = –6(73 - 68 - 72 - 69 = 282) |
CREATE TABLE table_name_93 (
lost INTEGER,
against VARCHAR,
played VARCHAR
) | What is the Lost with Against smaller than 25, and Played smaller than 1? | SELECT AVG(lost) FROM table_name_93 WHERE against < 25 AND played < 1 |
CREATE TABLE Catalog_Contents_Additional_Attributes (
catalog_entry_id VARCHAR,
catalog_level_number VARCHAR
)
CREATE TABLE Catalog_Contents (
catalog_entry_name VARCHAR,
catalog_entry_id VARCHAR
) | Find the names of catalog entries with level number 8. | SELECT t1.catalog_entry_name FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = "8" |
CREATE TABLE fare_basis (
fare_basis_code text,
booking_class text,
class_type text,
premium text,
economy text,
discounted text,
night text,
season text,
basis_days text
)
CREATE TABLE restriction (
restriction_code text,
advance_purchase int,
stopovers text,
saturd... | what flights leave from CHICAGO to SEATTLE on saturday | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SEATTLE' AND date_day.day_number = 26 AND date_day.month_number = 7 AND d... |
CREATE TABLE table_30247 (
"No." real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" real,
"U.S. viewers (million)" text
) | How many production codes are there for the episode that had 4.36 million u.s. viewers? | SELECT COUNT("Production code") FROM table_30247 WHERE "U.S. viewers (million)" = '4.36' |
CREATE TABLE table_name_95 (
opponent VARCHAR,
loss VARCHAR,
date VARCHAR
) | Loss of wilcox, and a Date of jun 18 had what opponent? | SELECT opponent FROM table_name_95 WHERE loss = "wilcox" AND date = "jun 18" |
CREATE TABLE table_2618113_1 (
directed_by VARCHAR,
production_code VARCHAR
) | Who directed k0122? | SELECT directed_by FROM table_2618113_1 WHERE production_code = "K0122" |
CREATE TABLE table_11703336_1 (
link_abilities VARCHAR,
predecessors VARCHAR
) | What is the link abilities when the predecessors is ti-85? | SELECT link_abilities FROM table_11703336_1 WHERE predecessors = "TI-85" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.