table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | how many patients whose admission year is less than 2156 and diagnoses short title is end stage renal disease? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2156" AND diagnoses.short_title = "End stage renal disease" |
CREATE TABLE table_16576 (
"Club" text,
"Position in 2012\u201313" text,
"First season in top division" text,
"Number of seasons in top division" real,
"Number of seasons in the Premier League" real,
"First season of current spell in top division" text,
"Top division titles" real,
"Last ... | What is the least number of seasons in top division? | SELECT MIN("Number of seasons in top division") FROM table_16576 |
CREATE TABLE table_54835 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What is the sum of crowds that saw hawthorn at home? | SELECT SUM("Crowd") FROM table_54835 WHERE "Home team" = 'hawthorn' |
CREATE TABLE table_34011 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" text
) | Who was the opponent when attendance was 60,355? | SELECT "Opponent" FROM table_34011 WHERE "Attendance" = '60,355' |
CREATE TABLE table_203_134 (
id number,
"place" text,
"player" text,
"country" text,
"score" text,
"to par" number
) | what player placed nest after dustin johnson ? | SELECT "player" FROM table_203_134 WHERE id = (SELECT id FROM table_203_134 WHERE "player" = 'dustin johnson') + 1 |
CREATE TABLE table_10411 (
"Class" text,
"Type" text,
"Quantity" real,
"Date" text,
"LNER Class" text,
"1946 LNER nos." text
) | On what date was the type 2-8-0 with a O4 LNER Class? | SELECT "Date" FROM table_10411 WHERE "Type" = '2-8-0' AND "LNER Class" = 'o4' |
CREATE TABLE table_20565 (
"Year" real,
"GDP Nominal ($ billions)" text,
"GDP Adjusted ($ billions)" text,
"Population (millions)" text,
"GDP per capita Nominal ($)" real,
"GDP per capita Adjusted ($)" real
) | What is the adjusted GDP per capita when the population is 37.376 million? | SELECT "GDP per capita Adjusted ($)" FROM table_20565 WHERE "Population (millions)" = '37.376' |
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 flight (
aircraft_code_sequence text,
airline_code varchar,
airline_flight text,
... | show me the airfare from PITTSBURGH to 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 = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.c... |
CREATE TABLE table_6652 (
"Year" text,
"Men's singles" text,
"Women's singles" text,
"Men's doubles" text,
"Women's doubles" text,
"Mixed doubles" text
) | Who won in mixed doubles in 2008? | SELECT "Mixed doubles" FROM table_6652 WHERE "Year" = '2008' |
CREATE TABLE table_1566852_7 (
interview_subject VARCHAR
) | HOW MANY TIMES WAS LUDACRIS THE INTERVIEW SUBJECT FOR THE 20 QUESTIONS COLUMN? | SELECT COUNT(20 AS _questions) FROM table_1566852_7 WHERE interview_subject = "Ludacris" |
CREATE TABLE gas_station (
Station_ID int,
Open_Year int,
Location text,
Manager_Name text,
Vice_Manager_Name text,
Representative_Name text
)
CREATE TABLE station_company (
Station_ID int,
Company_ID int,
Rank_of_the_Year int
)
CREATE TABLE company (
Company_ID int,
Rank i... | Show the number of companies without a gas station in each main industry with a bar chart, sort in desc by the X-axis. | SELECT Main_Industry, COUNT(Main_Industry) FROM company WHERE NOT Company_ID IN (SELECT Company_ID FROM station_company) GROUP BY Main_Industry ORDER BY Main_Industry DESC |
CREATE TABLE stadium (
average_attendance VARCHAR,
capacity_percentage INTEGER
) | What is the average attendance of stadiums with capacity percentage higher than 100%? | SELECT average_attendance FROM stadium WHERE capacity_percentage > 100 |
CREATE TABLE table_name_55 (
against INTEGER,
date VARCHAR
) | What is the smallest Against with a Date of 18/02/1989? | SELECT MIN(against) FROM table_name_55 WHERE date = "18/02/1989" |
CREATE TABLE affected_region (
Region_id int,
Storm_ID int,
Number_city_affected real
)
CREATE TABLE storm (
Storm_ID int,
Name text,
Dates_active text,
Max_speed int,
Damage_millions_USD real,
Number_Deaths int
)
CREATE TABLE region (
Region_id int,
Region_code text,
R... | Draw a bar chart for how many storms occured in each region?, list in descending by the the total number . | SELECT Region_name, COUNT(*) FROM region AS T1 JOIN affected_region AS T2 ON T1.Region_id = T2.Region_id GROUP BY T1.Region_id ORDER BY COUNT(*) DESC |
CREATE TABLE table_name_23 (
height INTEGER,
year_born VARCHAR,
current_club VARCHAR
) | How tall was the member of Nymburk, who was born in 1982? | SELECT MAX(height) FROM table_name_23 WHERE year_born = 1982 AND current_club = "nymburk" |
CREATE TABLE Financial_Transactions (
transaction_id INTEGER,
previous_transaction_id INTEGER,
account_id INTEGER,
card_id INTEGER,
transaction_type VARCHAR(15),
transaction_date DATETIME,
transaction_amount DOUBLE,
transaction_comment VARCHAR(255),
other_transaction_details VARCHAR(... | I want to know the proportion of the total number for each transaction type. | SELECT transaction_type, COUNT(*) FROM Financial_Transactions GROUP BY transaction_type |
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TAB... | Select all the posts with tag java. | SELECT Id, Title, Body FROM Posts AS P WHERE PostTypeId = 1 AND Tags LIKE '%three.js%' AND YEAR(P.CreationDate) BETWEEN 2015 AND 2019 |
CREATE TABLE table_67497 (
"Year" text,
"Venue" text,
"Winners" text,
"Runner-up" text,
"3rd place" text
) | Who came in 3rd place in 1990? | SELECT "3rd place" FROM table_67497 WHERE "Year" = '1990' |
CREATE TABLE table_72752 (
"Rank" real,
"City 1" text,
"City 2" text,
"2012 Passengers (in millions)" text,
"2011 Passengers (in millions)" text,
"Distance" text
) | Which city is listed first when Okinawa is listed as the second city? | SELECT "City 1" FROM table_72752 WHERE "City 2" = 'Okinawa' |
CREATE TABLE table_17288869_6 (
date VARCHAR,
game VARCHAR
) | What was the date of game 21? | SELECT date FROM table_17288869_6 WHERE game = 21 |
CREATE TABLE table_203_192 (
id number,
"year" number,
"competition" text,
"venue" text,
"position" text,
"notes" text
) | at what competition did david receive the least position ? | SELECT "competition" FROM table_203_192 ORDER BY "position" DESC LIMIT 1 |
CREATE TABLE table_76139 (
"Rank" real,
"Name" text,
"Years" text,
"Matches" real,
"Goals" real,
"Goals/Matches" real
) | What years have goals less than 229, and 440 as matches? | SELECT "Years" FROM table_76139 WHERE "Goals" < '229' AND "Matches" = '440' |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40)... | For those employees who do not work in departments with managers that have ids between 100 and 200, a line chart shows the change of employee_id over hire_date, display by the x axis from low to high. | SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY HIRE_DATE |
CREATE TABLE table_6077 (
"Image" text,
"Father" text,
"Birth" text,
"Ceased to be Duchess" text,
"Death" text,
"Husband" text
) | Which father had william iv as a husband? | SELECT "Father" FROM table_6077 WHERE "Husband" = 'william iv' |
CREATE TABLE table_65734 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
) | How many weeks have an Attendance of 62,289? | SELECT SUM("Week") FROM table_65734 WHERE "Attendance" = '62,289' |
CREATE TABLE mission (
Mission_ID int,
Ship_ID int,
Code text,
Launched_Year int,
Location text,
Speed_knots int,
Fate text
)
CREATE TABLE ship (
Ship_ID int,
Name text,
Type text,
Nationality text,
Tonnage int
) | Stack bar chart of the number of type vs Nationality based on type | SELECT Type, COUNT(Type) FROM ship GROUP BY Nationality, Type |
CREATE TABLE airline (
airline_code varchar,
airline_name text,
note text
)
CREATE TABLE compartment_class (
compartment varchar,
class_type varchar
)
CREATE TABLE equipment_sequence (
aircraft_code_sequence varchar,
aircraft_code varchar
)
CREATE TABLE flight_leg (
flight_id int,
... | show me all flights direct and connecting from BOSTON to PITTSBURGH that arrive in PITTSBURGH before 1000 | 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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND flight.arrival_time <= 1000 AND flight.to_airport = AIRPORT_SERVICE_1.air... |
CREATE TABLE table_name_96 (
name VARCHAR,
debut VARCHAR
) | What is the name of the player that had a debut in round 6? | SELECT name FROM table_name_96 WHERE debut = "round 6" |
CREATE TABLE table_37053 (
"Position" real,
"Driver" text,
"Wins" real,
"Poles" real,
"Top 5's" real,
"Points" real
) | How many points are associated with over 1 top 5, 1 win, over 0 poles, and andrew ranger as the driver? | SELECT MAX("Points") FROM table_37053 WHERE "Top 5's" > '1' AND "Wins" = '1' AND "Poles" > '0' AND "Driver" = 'andrew ranger' |
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE SuggestedEditVotes (
... | User's comments ordered by score. | SELECT Score, Text, PostId AS "post_link" FROM Comments WHERE UserId = '##UserId:int##' ORDER BY Score DESC |
CREATE TABLE mill (
Id VARCHAR
)
CREATE TABLE architect (
name VARCHAR,
nationality VARCHAR,
id VARCHAR
) | What are the distinct names and nationalities of the architects who have ever built a mill? | SELECT DISTINCT T1.name, T1.nationality FROM architect AS T1 JOIN mill AS t2 ON T1.id = T2.architect_id |
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime ti... | a year before what were the top five most frequent procedures that patients were given within 2 months after the diagnosis of abnrml coagultion prfile? | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissi... |
CREATE TABLE table_2221484_2 (
original_air_date VARCHAR,
series__number VARCHAR
) | What date did episode 258 in the series originally air? | SELECT original_air_date FROM table_2221484_2 WHERE series__number = 258 |
CREATE TABLE aircraft (
aid number(9,0),
name varchar2(30),
distance number(6,0)
)
CREATE TABLE flight (
flno number(4,0),
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0)
)
CREAT... | Draw a bar chart of destination versus the total number, sort by the x-axis in asc. | SELECT destination, COUNT(*) FROM flight GROUP BY destination ORDER BY destination |
CREATE TABLE Students (
student_id INTEGER,
date_of_registration DATETIME,
date_of_latest_logon DATETIME,
login_name VARCHAR(40),
password VARCHAR(10),
personal_name VARCHAR(40),
middle_name VARCHAR(40),
family_name VARCHAR(40)
)
CREATE TABLE Student_Course_Enrolment (
registration_... | A bar chart for what are the number of the enrollment dates of all the tests that have result 'Pass'? | SELECT date_of_enrolment, COUNT(date_of_enrolment) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Pass" |
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE PostsWithDeleted (
Id number,
PostTypeId number,
... | My answers to questions tagged jquery and not tagged javascript. My answers to questions tagged [r] | SELECT q.Id AS "post_link", q.Title, q.Tags, a.Score FROM Posts AS q INNER JOIN Posts AS a ON q.Id = a.ParentId AND a.PostTypeId = 2 AND q.PostTypeId = 1 WHERE a.CommunityOwnedDate IS NULL AND a.OwnerUserId = '##UserId##' AND q.Tags LIKE '%jquery%' AND NOT q.Tags LIKE '%javascript%' ORDER BY a.Score DESC |
CREATE TABLE table_76508 (
"Finished" text,
"Horse" text,
"Jockey" text,
"Trainer" text,
"Odds" text
) | Who is the Jockey that has Nick Zito as Trainer and Odds of 34-1? | SELECT "Jockey" FROM table_76508 WHERE "Trainer" = 'nick zito' AND "Odds" = '34-1' |
CREATE TABLE table_13114 (
"Shooter" text,
"Event" text,
"Rank points" text,
"Score points" text,
"Total" text
) | Which shooter was the olympic bronze medalist? | SELECT "Shooter" FROM table_13114 WHERE "Total" = 'olympic bronze medalist' |
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 diagnoses short title is dmii renl nt st uncntrld and lab test abnormal status is abnormal? | 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.short_title = "DMII renl nt st uncntrld" AND lab.flag = "abnormal" |
CREATE TABLE table_19872699_1 (
builder VARCHAR,
skipper VARCHAR
) | Who build the boat where Ken Read was the skipper? | SELECT builder FROM table_19872699_1 WHERE skipper = "Ken Read" |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | how many patients are diagnosed with primary disease complete heart block? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "COMPLETE HEART BLOCK" |
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Country text,
Opening_year 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... | Plot mean meter 100 by grouped by meter 200 as a bar graph | SELECT meter_200, AVG(meter_100) FROM swimmer GROUP BY meter_200 |
CREATE TABLE table_43535 (
"Name" text,
"Country" text,
"Type" text,
"Moving from" text,
"Transfer window" text,
"Ends" real,
"Transfer fee" text,
"Source" text
) | What is the type when 120,000 is the transfer fee? | SELECT "Type" FROM table_43535 WHERE "Transfer fee" = '£120,000' |
CREATE TABLE table_name_16 (
tries_for VARCHAR,
played VARCHAR,
points_against VARCHAR
) | What is the value for the item 'Tries' when the value of the item 'Played' is 18 and the value of the item 'Points' is 375? | SELECT tries_for FROM table_name_16 WHERE played = "18" AND points_against = "375" |
CREATE TABLE building (
Id VARCHAR
) | How many buildings are there? | SELECT COUNT(*) FROM building |
CREATE TABLE table_32882 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | What is the time/retired for grid 3? | SELECT "Time/Retired" FROM table_32882 WHERE "Grid" = '3' |
CREATE TABLE table_35860 (
"Tournament" text,
"Wins" real,
"Top-5" real,
"Top-10" real,
"Top-25" real,
"Events" real,
"Cuts made" real
) | Name the averae top 25 with events less than 0 | SELECT AVG("Top-25") FROM table_35860 WHERE "Events" < '0' |
CREATE TABLE table_name_94 (
saturated_fat VARCHAR,
total_fat VARCHAR,
polyunsaturated_fat VARCHAR
) | What is the saturated fat with a total fat of 100g and 11g of polyunsaturated fat? | SELECT saturated_fat FROM table_name_94 WHERE total_fat = "100g" AND polyunsaturated_fat = "11g" |
CREATE TABLE table_40868 (
"Played" text,
"Wins" text,
"Losses" text,
"Tied" text,
"Win %" text
) | What was tied at 15 played? | SELECT "Tied" FROM table_40868 WHERE "Played" = '15' |
CREATE TABLE table_204_443 (
id number,
"week" number,
"date" text,
"opponent" text,
"result" text,
"game site" text,
"attendance" number,
"bye" text
) | what is the difference in attendance between the first and last game of the season ? | SELECT ABS((SELECT "attendance" FROM table_204_443 ORDER BY "date" LIMIT 1) - (SELECT "attendance" FROM table_204_443 ORDER BY "date" DESC LIMIT 1)) |
CREATE TABLE table_52100 (
"Team" text,
"Points" real,
"Played" real,
"Drawn" real,
"Lost" real,
"Against" real,
"Diff" real
) | What is the difference with a loss smaller than 5 and points lower than 32? | SELECT COUNT("Diff") FROM table_52100 WHERE "Lost" < '5' AND "Points" < '32' |
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... | how many patients whose diagnoses icd9 code is 56212 and drug route is ed? | 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.icd9_code = "56212" AND prescriptions.route = "ED" |
CREATE TABLE table_28969 (
"Species" text,
"Common Name" text,
"Protein Name" text,
"Accession Number" text,
"NT Length" text,
"NT Identity" text,
"AA Length" text,
"AA Identity" text,
"E-Value" text
) | What is the protein name when aa length is 202 aa? | SELECT "Protein Name" FROM table_28969 WHERE "AA Length" = '202 aa' |
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Comments (
Id num... | Overall statistics of questions with specific tag. | WITH Questions AS (SELECT *, (SELECT SUM(A.Score) FROM Posts AS A WHERE A.ParentId = Q.Id) AS "answerscore", (CASE WHEN NOT Q.AcceptedAnswerId IS NULL OR EXISTS(SELECT * FROM Posts AS A WHERE A.ParentId = Q.Id AND A.Score > 0) THEN 1 ELSE 0 END) AS "answered" FROM Posts AS Q WHERE Q.PostTypeId = 1 AND Q.Score <= @MaxVo... |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | provide the number of patients who are married and their lab test name is oxygen. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "MARRIED" AND lab.label = "Oxygen" |
CREATE TABLE table_name_95 (
standard_cost__usd_ VARCHAR,
creator VARCHAR
) | What is the Standard cost (USD) of Kwin team creator? | SELECT standard_cost__usd_ FROM table_name_95 WHERE creator = "kwin team" |
CREATE TABLE table_204_415 (
id number,
"season" text,
"tier" number,
"division" text,
"place" text
) | what is his/her best ranking season ? | SELECT "season" FROM table_204_415 ORDER BY "place" LIMIT 1 |
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE Tags (
Id number,
TagName text,
Count ... | Search answers by any keyword. | SELECT p.CreationDate, p.Body, p.Id AS "post_link" FROM Posts AS p WHERE p.PostTypeId = 2 AND p.Body LIKE '%##keyword1##%' |
CREATE TABLE department (
dept_name varchar(20),
building varchar(15),
budget numeric(12,2)
)
CREATE TABLE instructor (
ID varchar(5),
name varchar(20),
dept_name varchar(20),
salary numeric(8,2)
)
CREATE TABLE teaches (
ID varchar(5),
course_id varchar(8),
sec_id varchar(8),
... | Display a bar chart for what are the names and budgets of departments with budgets greater than the average?, and order total number in asc order. | SELECT dept_name, budget FROM department WHERE budget > (SELECT AVG(budget) FROM department) ORDER BY budget |
CREATE TABLE VISITORS (
Tourist_Details VARCHAR
) | Show details of all visitors. | SELECT Tourist_Details FROM VISITORS |
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE flight (
aircraft_code_sequence text,
airline_code varchar,
airline_flight text,
arrival_time int,
connections int,
departure_time int,
dual_carrier text,
flight_days text... | what airlines fly from BOSTON to PITTSBURGH | SELECT DISTINCT airline.airline_code FROM airline, 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_na... |
CREATE TABLE table_54008 (
"Year" text,
"TCKL" real,
"SACK" real,
"P/KO RET" real,
"YARDS" real
) | What is the total of TCKL in 2000 with a P/KO RET less than 14? | SELECT COUNT("TCKL") FROM table_54008 WHERE "Year" = '2000' AND "P/KO RET" < '14' |
CREATE TABLE has_allergy (
stuid number,
allergy text
)
CREATE TABLE allergy_type (
allergy text,
allergytype text
)
CREATE TABLE student (
stuid number,
lname text,
fname text,
age number,
sex text,
major number,
advisor number,
city_code text
) | What are the different majors? | SELECT DISTINCT major FROM student |
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... | Show me the number of patients on po/ng route of drug administration who have been diagnosed with other specified perinatal disorders of the digestive system. | 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 = "Perinat GI sys dis NEC" AND prescriptions.route = "PO/NG" |
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text 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... | Is AERO 410 always taught by either Prof. Rudolph Ware or Prof. Ryan Baxter ? | SELECT COUNT(*) = 0 FROM course, course_offering, instructor, offering_instructor WHERE (NOT instructor.name LIKE '%Rudolph Ware%' AND NOT instructor.name LIKE '%Ryan Baxter%') AND course.course_id = course_offering.course_id AND course.department = 'AERO' AND course.number = 410 AND offering_instructor.instructor_id =... |
CREATE TABLE table_name_85 (
points INTEGER,
points_against VARCHAR,
losses VARCHAR
) | What is the average Points when the Points Against is 594, and Losses is more than 3? | SELECT AVG(points) FROM table_name_85 WHERE points_against = 594 AND losses > 3 |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE prescription... | what is days of hospital stay and death status of subject id 17519? | SELECT demographic.days_stay, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "17519" |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
C... | count the number of patients whose admission location is transfer from hosp/extram and procedure icd9 code is 4131? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND procedures.icd9_code = "4131" |
CREATE TABLE table_name_32 (
date VARCHAR,
competition VARCHAR,
venue VARCHAR
) | On what date was a friendly match held at Auckland? | SELECT date FROM table_name_32 WHERE competition = "friendly match" AND venue = "auckland" |
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... | how many days have it been since patient 012-20116 last received a vancomycin hcl 1000 mg iv solr prescription on this hospital encounter? | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', medication.drugstarttime)) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-201... |
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 departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE... | For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, give me the comparison about the sum of salary over the hire_date bin hire_date by weekday by a bar chart, display sum salary in desc order. | SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY SUM(SALARY) DESC |
CREATE TABLE table_76665 (
"Round #" real,
"Pick" real,
"Player" text,
"Position" text,
"College" text
) | Which pick came from Texas El-Paso? | SELECT SUM("Pick") FROM table_76665 WHERE "College" = 'texas el-paso' |
CREATE TABLE table_13565 (
"Year" real,
"Stage" real,
"Start of stage" text,
"Distance (km)" text,
"Category of climb" text,
"Stage winner" text,
"Yellow jersey" text
) | What is the distance for Jos -Manuel Fuente when the stage was less than 16? | SELECT "Distance (km)" FROM table_13565 WHERE "Stage" < '16' AND "Stage winner" = 'josé-manuel fuente' |
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 diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | provide the number of patients who were admitted via emergency hospital room and diagnosed with acute diastolic heart failure. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND diagnoses.long_title = "Acute diastolic heart failure" |
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostFeedb... | Total bounty amount on the site. | SELECT SUM(BountyAmount) FROM Votes WHERE NOT BountyAmount IS NULL AND VoteTypeId = 8 |
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
) | For those records from the products and each product's manufacturer, show me about the distribution of name and the average of revenue , and group by attribute name in a bar chart, order y axis from high to low order. | SELECT T1.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T2.Revenue DESC |
CREATE TABLE event (
ID int,
Name text,
Stadium_ID int,
Year text
)
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Country text,
Opening_year int
)
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
CREATE TABLE swimme... | Draw a bar chart about the distribution of meter_500 and ID , and I want to rank y-axis in desc order. | SELECT meter_500, ID FROM swimmer ORDER BY ID DESC |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE d_labitems (
row_id ... | how many days have pass since the last time patient 97733 was prescribed thiamine hcl on their current hospital visit? | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', prescriptions.startdate)) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 97733 AND admissions.dischtime IS NULL) AND prescriptions.drug = 'thiamine hcl' ORDER BY prescriptions.startdat... |
CREATE TABLE player_award (
player_id text,
award_id text,
year number,
league_id text,
tie text,
notes text
)
CREATE TABLE player (
player_id text,
birth_year text,
birth_month text,
birth_day text,
birth_country text,
birth_state text,
birth_city text,
death_ye... | Top 10 countries with the most hall of fame players | SELECT T1.birth_country FROM player AS T1 JOIN hall_of_fame AS T2 ON T1.player_id = T2.player_id WHERE T2.inducted = "Y" GROUP BY T1.birth_country ORDER BY COUNT(*) DESC LIMIT 10 |
CREATE TABLE table_18847456_2 (
opponents INTEGER,
date VARCHAR
) | How many points did the opposing team score on Dec. 19, 1982? | SELECT MAX(opponents) FROM table_18847456_2 WHERE date = "Dec. 19" |
CREATE TABLE table_name_14 (
company VARCHAR,
director VARCHAR,
year VARCHAR
) | What company does Simon Stone direct earlier than 2011? | SELECT company FROM table_name_14 WHERE director = "simon stone" AND year < 2011 |
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... | what is days of hospital stay and admission location of subject name mary davis? | SELECT demographic.days_stay, demographic.admission_location FROM demographic WHERE demographic.name = "Mary Davis" |
CREATE TABLE Customer_Orders (
order_id INTEGER,
customer_id INTEGER,
order_status_code VARCHAR(10),
order_date DATETIME
)
CREATE TABLE Supplier_Addresses (
supplier_id INTEGER,
address_id INTEGER,
date_from DATETIME,
date_to DATETIME
)
CREATE TABLE Products (
product_id INTEGER,
... | A bar chart about how many customers use each payment method?, order Y in asc order. | SELECT payment_method_code, COUNT(*) FROM Customers GROUP BY payment_method_code ORDER BY COUNT(*) |
CREATE TABLE table_name_73 (
distance VARCHAR,
time VARCHAR
) | Which Distance has a Time of 2:20.00? | SELECT distance FROM table_name_73 WHERE time = "2:20.00" |
CREATE TABLE table_train_279 (
"id" int,
"systolic_blood_pressure_sbp" int,
"hemoglobin_a1c_hba1c" float,
"estimated_glomerular_filtration_rate_egfr" int,
"fasting_plasma_glucose" int,
"diastolic_blood_pressure_dbp" int,
"body_mass_index_bmi" float,
"NOUSE" float
) | fasting plasma glucose during the screening period < / = 240 mg / dl | SELECT * FROM table_train_279 WHERE fasting_plasma_glucose <= 240 |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
... | what is days of hospital stay and procedure icd9 code of subject id 8323? | SELECT demographic.days_stay, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "8323" |
CREATE TABLE table_17989 (
"No." real,
"Air Date" text,
"Rating" text,
"Share" real,
"18-49 (Rating/Share)" text,
"Viewers (m)" text,
"Night" real,
"Timeslot" real,
"Overall" text
) | what are all the rating with viewers (m) being 2.61 | SELECT "Rating" FROM table_17989 WHERE "Viewers (m)" = '2.61' |
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 procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
... | what is average age of patients whose primary disease is bowel obstruction and who are aged equal or more than 71 years? | SELECT AVG(demographic.age) FROM demographic WHERE demographic.diagnosis = "BOWEL OBSTRUCTION" AND demographic.age >= "71" |
CREATE TABLE table_12039 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | Who did Hawthorn play against at their home match? | SELECT "Away team" FROM table_12039 WHERE "Home team" = 'hawthorn' |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
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 t... | provide the number of patients with government insurance who have been diagnosed with parox ventric tachycard. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Government" AND diagnoses.short_title = "Parox ventric tachycard" |
CREATE TABLE table_243664_1 (
game_cost VARCHAR,
real_life_eventual_outcome VARCHAR
) | Name the game cost for merged with new york central to form penn central | SELECT game_cost FROM table_243664_1 WHERE real_life_eventual_outcome = "Merged with New York Central to form Penn Central" |
CREATE TABLE table_name_64 (
year VARCHAR,
rank VARCHAR
) | Which Year has a Rank of 25? | SELECT year FROM table_name_64 WHERE rank = "25" |
CREATE TABLE driver (
home_city VARCHAR,
age INTEGER
) | Show home city where at least two drivers older than 40 are from. | SELECT home_city FROM driver WHERE age > 40 GROUP BY home_city HAVING COUNT(*) >= 2 |
CREATE TABLE home_game (
year INTEGER,
league_id TEXT,
team_id TEXT,
park_id TEXT,
span_first TEXT,
span_last TEXT,
games INTEGER,
openings INTEGER,
attendance INTEGER
)
CREATE TABLE college (
college_id TEXT,
name_full TEXT,
city TEXT,
state TEXT,
country TEXT
)... | What is the average number of attendance at home games for each year Plot them as line chart, and could you display year in desc order? | SELECT year, AVG(attendance) FROM home_game GROUP BY year ORDER BY year DESC |
CREATE TABLE table_204_414 (
id number,
"name" text,
"armenian" text,
"location" text,
"# of prisoners designed for" number,
"notes" text
) | besides vardashen , what other correctional facility was designed for less than 200 prisoners ? | SELECT "name" FROM table_204_414 WHERE "name" <> 'vardashen' AND "# of prisoners designed for" < 200 |
CREATE TABLE table_204_842 (
id number,
"institution" text,
"city" text,
"state" text,
"team name" text,
"affiliation" text,
"enrollment" number,
"home conference" text
) | which state has the most member schools ? | SELECT "state" FROM table_204_842 GROUP BY "state" ORDER BY COUNT("institution") DESC LIMIT 1 |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
... | count the number of patients whose discharge location is left against medical advi and year of birth is less than 2156? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "LEFT AGAINST MEDICAL ADVI" AND demographic.dob_year < "2156" |
CREATE TABLE table_9987 (
"Team" text,
"Region" text,
"Coach" text,
"Home ground" text,
"Capacity" real
) | What is the home ground in region NZL? | SELECT "Home ground" FROM table_9987 WHERE "Region" = 'nzl' |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE m... | what was the last medication that was prescribed to patient 006-157753 during this hospital visit via im route? | SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-157753' AND patient.hospitaldischargetime IS NULL)) AND medicat... |
CREATE TABLE Services (
Service_ID INTEGER,
Service_name VARCHAR(40)
)
CREATE TABLE First_Notification_of_Loss (
FNOL_ID INTEGER,
Customer_ID INTEGER,
Policy_ID INTEGER,
Service_ID INTEGER
)
CREATE TABLE Settlements (
Settlement_ID INTEGER,
Claim_ID INTEGER,
Effective_Date DATE,
... | Draw a bar chart for what is the ordered list of customer ids? | SELECT Customer_name, Customer_ID FROM Customers ORDER BY Customer_ID |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.