answer
stringlengths 6
3.91k
| question
stringlengths 7
766
| context
stringlengths 27
7.14k
|
---|---|---|
SELECT city FROM station GROUP BY city ORDER BY MAX(lat) DESC | List all the cities in a decreasing order of each city's stations' highest latitude. | CREATE TABLE station (city VARCHAR, lat INTEGER) |
SELECT opponent FROM table_name_65 WHERE save = "smith (22)" | Which opponent has a save of smith (22)? | CREATE TABLE table_name_65 (
opponent VARCHAR,
save VARCHAR
) |
SELECT result FROM table_1341690_20 WHERE incumbent = "Robert Bauman" | What are all the results where Robert Bauman is the incumbent politician? | CREATE TABLE table_1341690_20 (result VARCHAR, incumbent VARCHAR) |
SELECT date, cloud_cover FROM weather ORDER BY cloud_cover DESC LIMIT 5 | What are the dates that had the top 5 cloud cover rates? Also tell me the cloud cover rate. | CREATE TABLE weather (date VARCHAR, cloud_cover VARCHAR) |
SELECT win_draw_lose FROM table_name_71 WHERE venue = "home" AND team = "derby county" | What was the result of the home game against Derby County? | CREATE TABLE table_name_71 (
win_draw_lose VARCHAR,
venue VARCHAR,
team VARCHAR
) |
SELECT candidates FROM table_1341690_35 WHERE incumbent = "Del Latta" | Who were the candidates in the district won by the incumbent Del Latta? | CREATE TABLE table_1341690_35 (candidates VARCHAR, incumbent VARCHAR) |
SELECT id, duration FROM trip ORDER BY duration DESC LIMIT 3 | What are the ids and durations of the trips with the top 3 durations? | CREATE TABLE trip (id VARCHAR, duration VARCHAR) |
SELECT AVG(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 16472)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [systolic]' AND d_items.linksto = 'chartevents') AND STRFTIME('%y-%m-%d', chartevents.charttime) <= '2105-08-15' | tell me the average arterial bp [systolic] of patient 16472 until 08/15/2105? | CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
wardid number,
intime time,
outtime time
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text,
first_wardid number,
last_wardid number,
intime time,
outtime time
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location text,
insurance text,
language text,
marital_status text,
ethnicity text,
age number
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
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
) |
SELECT candidates FROM table_1341690_35 WHERE first_elected = 1966 | Who were the candidates in the districts that was first elected in 1966? | CREATE TABLE table_1341690_35 (candidates VARCHAR, first_elected VARCHAR) |
SELECT T1.name, T1.long, AVG(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id GROUP BY T2.start_station_id | For each station, return its longitude and the average duration of trips that started from the station. | CREATE TABLE station (name VARCHAR, long VARCHAR, id VARCHAR); CREATE TABLE trip (duration INTEGER, start_station_id VARCHAR) |
SELECT SUM("Total") FROM table_43812 WHERE "Club" = 'darlington' AND "League goals" = '13' AND "League Cup goals" = '1' | Which Total has a Club of darlington, and a League goals of 13, and a League Cup goals of 1? | CREATE TABLE table_43812 (
"Club" text,
"League goals" text,
"FA Cup goals" text,
"League Cup goals" text,
"Total" real
) |
SELECT candidates FROM table_1341690_5 WHERE district = "California 10" | Who was running for office in the California 10 district? | CREATE TABLE table_1341690_5 (candidates VARCHAR, district VARCHAR) |
SELECT T1.name, T1.lat, MIN(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.end_station_id GROUP BY T2.end_station_id | For each station, find its latitude and the minimum duration of trips that ended at the station. | CREATE TABLE trip (duration INTEGER, end_station_id VARCHAR); CREATE TABLE station (name VARCHAR, lat VARCHAR, id VARCHAR) |
SELECT DisplayName, Reputation, WebsiteUrl, Location FROM Users WHERE Location LIKE '%germany%' OR Location LIKE '%Germany%' OR Location LIKE N'%DE%' OR Location LIKE N'%de%' OR Location LIKE N'%deutschland%' ORDER BY Reputation DESC LIMIT 3000 | Top SO users from germany. | CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
OwnerUserId number,
Comment text,
Text text,
Title text,
Tags text,
RevisionGUID other
)
CREATE TABLE VoteTypes (
Id number,
Name text
)
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,
LastEditDate time,
LastActivityDate time,
Title text,
Tags text,
AnswerCount number,
CommentCount number,
FavoriteCount number,
ClosedDate time,
CommunityOwnedDate time,
ContentLicense text
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDate time,
ApprovalModeratorId number,
DeactivationDate time,
DeactivationModeratorId number
)
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment text,
Text text,
ContentLicense text
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,
IsHidden boolean,
Predefined boolean,
PostNoticeDurationId number
)
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
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
)
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate time
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
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,
LastEditorDisplayName text,
LastEditDate time,
LastActivityDate time,
Title text,
Tags text,
AnswerCount number,
CommentCount number,
FavoriteCount number,
ClosedDate time,
CommunityOwnedDate time,
ContentLicense text
)
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
) |
SELECT COUNT(party) FROM table_1341690_5 WHERE district = "California 23" | How many parties won the election in the California 23 district? | CREATE TABLE table_1341690_5 (party VARCHAR, district VARCHAR) |
SELECT DISTINCT start_station_name FROM trip WHERE duration < 100 | List all the distinct stations from which a trip of duration below 100 started. | CREATE TABLE trip (start_station_name VARCHAR, duration INTEGER) |
SELECT * FROM table_train_103 WHERE age >= 65 | age 65 years and older | CREATE TABLE table_train_103 (
"id" int,
"systolic_blood_pressure_sbp" int,
"epilepsy" bool,
"diastolic_blood_pressure_dbp" int,
"heart_rate" int,
"seizure_disorder" bool,
"age" float,
"NOUSE" float
) |
SELECT MAX(first_elected) FROM table_1341690_5 WHERE party = "Republican" | What republican candidate was first elected most recently? | CREATE TABLE table_1341690_5 (first_elected INTEGER, party VARCHAR) |
SELECT DISTINCT zip_code FROM weather EXCEPT SELECT DISTINCT zip_code FROM weather WHERE max_dew_point_f >= 70 | Find all the zip codes in which the max dew point have never reached 70. | CREATE TABLE weather (zip_code VARCHAR, max_dew_point_f VARCHAR) |
SELECT location FROM table_name_4 WHERE frequency = "102.5 fm" | Which Location has a Frequency of 102.5 fm? | CREATE TABLE table_name_4 (
location VARCHAR,
frequency VARCHAR
) |
SELECT district FROM table_1341707_12 WHERE first_elected = 1952 | Phillip Landrum was first elected in 1952 from the ninth district of Georgia. | CREATE TABLE table_1341707_12 (district VARCHAR, first_elected VARCHAR) |
SELECT id FROM trip WHERE duration >= (SELECT AVG(duration) FROM trip WHERE zip_code = 94103) | Find the id for the trips that lasted at least as long as the average duration of trips in zip code 94103. | CREATE TABLE trip (id VARCHAR, duration INTEGER, zip_code VARCHAR) |
SELECT MIN(crowd) FROM table_name_89 WHERE venue = "victoria park" | What is the smallest crowd for victoria park? | CREATE TABLE table_name_89 (
crowd INTEGER,
venue VARCHAR
) |
SELECT party FROM table_1341707_15 WHERE district = "Illinois 12" | What party did the incumbent from the Illinois 12 district belong to? | CREATE TABLE table_1341707_15 (party VARCHAR, district VARCHAR) |
SELECT date FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31 | What are the dates in which the mean sea level pressure was between 30.3 and 31? | CREATE TABLE weather (date VARCHAR, mean_sea_level_pressure_inches INTEGER) |
SELECT MAX("Season no.") FROM table_73846 WHERE "Title" = 'Stray' | What episode number in the season is titled 'stray'? | CREATE TABLE table_73846 (
"Season no." real,
"Series no." real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" text
) |
SELECT incumbent FROM table_1341707_15 WHERE party = "Democratic" AND result = "Re-elected" AND district = "Illinois 11" | Who was the democratic incumbent in the Illinois 11 district who was re-elected? | CREATE TABLE table_1341707_15 (incumbent VARCHAR, district VARCHAR, party VARCHAR, result VARCHAR) |
SELECT date, max_temperature_f - min_temperature_f FROM weather ORDER BY max_temperature_f - min_temperature_f LIMIT 1 | Find the day in which the difference between the max temperature and min temperature was the smallest. Also report the difference. | CREATE TABLE weather (date VARCHAR, max_temperature_f VARCHAR, min_temperature_f VARCHAR) |
SELECT "Position" FROM table_439 WHERE "Overall Pick #" = '17' | What is the position for the pick number 17? | CREATE TABLE table_439 (
"Overall Pick #" real,
"AFL Team" text,
"Player" text,
"Position" text,
"College" text
) |
SELECT incumbent FROM table_1341707_15 WHERE first_elected = "1964" | Which incumbent was first elected in 1964? | CREATE TABLE table_1341707_15 (incumbent VARCHAR, first_elected VARCHAR) |
SELECT DISTINCT T1.id, T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available > 12 | What are the id and name of the stations that have ever had more than 12 bikes available? | CREATE TABLE station (id VARCHAR, name VARCHAR); CREATE TABLE status (station_id VARCHAR, bikes_available INTEGER) |
SELECT MIN(no) FROM table_15621965_18 WHERE position = "Forward-Center" | WHAT WAS THE NUMBER OF THE ONLY FORWARD-CENTER TO MAKE THE ROSTER? | CREATE TABLE table_15621965_18 (
no INTEGER,
position VARCHAR
) |
SELECT party FROM table_1341707_15 WHERE district = "Illinois 1" | What party did the incumbent from the Illinois 1 district belong to? | CREATE TABLE table_1341707_15 (party VARCHAR, district VARCHAR) |
SELECT zip_code FROM weather GROUP BY zip_code HAVING AVG(mean_humidity) < 70 INTERSECT SELECT zip_code FROM trip GROUP BY zip_code HAVING COUNT(*) >= 100 | Give me the zip code where the average mean humidity is below 70 and at least 100 trips took place. | CREATE TABLE weather (zip_code VARCHAR, mean_humidity INTEGER); CREATE TABLE trip (zip_code VARCHAR, mean_humidity INTEGER) |
SELECT "Class Pos." FROM table_77295 WHERE "Pos." = '4th' | What was the class position of the team that was in the 4th position? | CREATE TABLE table_77295 (
"Year" real,
"Team" text,
"Co-Drivers" text,
"Class" text,
"Laps" real,
"Pos." text,
"Class Pos." text
) |
SELECT candidates FROM table_1341690_9 WHERE incumbent = "Don Fuqua" | What candidates ran in the election with don fuqua? | CREATE TABLE table_1341690_9 (candidates VARCHAR, incumbent VARCHAR) |
SELECT name FROM station WHERE city = "Palo Alto" EXCEPT SELECT end_station_name FROM trip GROUP BY end_station_name HAVING COUNT(*) > 100 | What are the names of stations that are located in Palo Alto city but have never been the ending point of trips more than 100 times? | CREATE TABLE trip (name VARCHAR, end_station_name VARCHAR, city VARCHAR); CREATE TABLE station (name VARCHAR, end_station_name VARCHAR, city VARCHAR) |
SELECT customer_last_name, COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id | How many accounts for each customer? Show a bar chart that groups by customer's last name. | CREATE TABLE Product_Categories (
production_type_code VARCHAR(15),
product_type_description VARCHAR(80),
vat_rating DECIMAL(19,4)
)
CREATE TABLE Accounts (
account_id INTEGER,
customer_id INTEGER,
date_account_opened DATETIME,
account_name VARCHAR(50),
other_account_details VARCHAR(255)
)
CREATE TABLE Customers (
customer_id INTEGER,
customer_first_name VARCHAR(50),
customer_middle_initial VARCHAR(1),
customer_last_name VARCHAR(50),
gender VARCHAR(1),
email_address VARCHAR(255),
login_name VARCHAR(80),
login_password VARCHAR(20),
phone_number VARCHAR(255),
town_city VARCHAR(50),
state_county_province VARCHAR(50),
country VARCHAR(50)
)
CREATE TABLE Financial_Transactions (
transaction_id INTEGER,
account_id INTEGER,
invoice_number INTEGER,
transaction_type VARCHAR(15),
transaction_date DATETIME,
transaction_amount DECIMAL(19,4),
transaction_comment VARCHAR(255),
other_transaction_details VARCHAR(255)
)
CREATE TABLE Invoice_Line_Items (
order_item_id INTEGER,
invoice_number INTEGER,
product_id INTEGER,
product_title VARCHAR(80),
product_quantity VARCHAR(50),
product_price DECIMAL(19,4),
derived_product_cost DECIMAL(19,4),
derived_vat_payable DECIMAL(19,4),
derived_total_cost DECIMAL(19,4)
)
CREATE TABLE Invoices (
invoice_number INTEGER,
order_id INTEGER,
invoice_date DATETIME
)
CREATE TABLE Order_Items (
order_item_id INTEGER,
order_id INTEGER,
product_id INTEGER,
product_quantity VARCHAR(50),
other_order_item_details VARCHAR(255)
)
CREATE TABLE Orders (
order_id INTEGER,
customer_id INTEGER,
date_order_placed DATETIME,
order_details VARCHAR(255)
)
CREATE TABLE Products (
product_id INTEGER,
parent_product_id INTEGER,
production_type_code VARCHAR(15),
unit_price DECIMAL(19,4),
product_name VARCHAR(80),
product_color VARCHAR(20),
product_size VARCHAR(20)
) |
SELECT COUNT(incumbent) FROM table_1341690_9 WHERE candidates = "Sam M. Gibbons (D) Unopposed" | How many incumbent candidates in the election featuring sam m. gibbons (d) unopposed? | CREATE TABLE table_1341690_9 (incumbent VARCHAR, candidates VARCHAR) |
SELECT COUNT(*) FROM station AS T1 JOIN trip AS T2 JOIN station AS T3 JOIN trip AS T4 ON T1.id = T2.start_station_id AND T2.id = T4.id AND T3.id = T4.end_station_id WHERE T1.city = "Mountain View" AND T3.city = "Palo Alto" | How many trips started from Mountain View city and ended at Palo Alto city? | CREATE TABLE station (city VARCHAR, id VARCHAR); CREATE TABLE trip (end_station_id VARCHAR, id VARCHAR); CREATE TABLE station (id VARCHAR, city VARCHAR); CREATE TABLE trip (start_station_id VARCHAR, id VARCHAR) |
SELECT date FROM table_2446333_2 WHERE circuit = "Eastern Creek Raceway" | Name the date for eastern creek raceway | CREATE TABLE table_2446333_2 (
date VARCHAR,
circuit VARCHAR
) |
SELECT MAX(first_elected) FROM table_1341690_9 | What is the last year that someone is first elected? | CREATE TABLE table_1341690_9 (first_elected INTEGER) |
SELECT AVG(T1.lat), AVG(T1.long) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id | What is the average latitude and longitude of the starting points of all trips? | CREATE TABLE trip (start_station_id VARCHAR); CREATE TABLE station (lat INTEGER, long INTEGER, id VARCHAR) |
SELECT MIN("Total Kurdistan List") FROM table_26850 | Name the least total kurdistan list | CREATE TABLE table_26850 (
"Governorate" text,
"Kurdistan Democratic Party" real,
"Patriotic Union of Kurdistan" real,
"Total Kurdistan List" real,
"Total Governorate Seats" real
) |
SELECT incumbent FROM table_1341690_9 WHERE first_elected = 1940 | Who was the incumbent in 1940? | CREATE TABLE table_1341690_9 (incumbent VARCHAR, first_elected VARCHAR) |
SELECT COUNT(*) FROM book | How many books are there? | CREATE TABLE book (Id VARCHAR) |
SELECT MIN(week) FROM table_name_40 WHERE record = "8–5" | What is the earliest week that shows a record of 8 5? | CREATE TABLE table_name_40 (
week INTEGER,
record VARCHAR
) |
SELECT party FROM table_1341718_14 WHERE incumbent = "Sidney R. Yates" | what is the party when the incumbent is sidney r. yates? | CREATE TABLE table_1341718_14 (party VARCHAR, incumbent VARCHAR) |
SELECT Writer FROM book ORDER BY Writer | List the writers of the books in ascending alphabetical order. | CREATE TABLE book (Writer VARCHAR) |
SELECT Carrier, COUNT(Carrier) FROM phone GROUP BY Carrier | Create a pie chart showing the number of carrier across carrier. | CREATE TABLE market (
Market_ID int,
District text,
Num_of_employees int,
Num_of_shops real,
Ranking int
)
CREATE TABLE phone (
Name text,
Phone_ID int,
Memory_in_G int,
Carrier text,
Price real
)
CREATE TABLE phone_market (
Market_ID int,
Phone_ID text,
Num_of_stock int
) |
SELECT MAX(first_elected) FROM table_1341718_14 WHERE district = "Illinois 7" | what was the year first elected for district illinois 7? | CREATE TABLE table_1341718_14 (first_elected INTEGER, district VARCHAR) |
SELECT Title FROM book ORDER BY Issues | List the titles of the books in ascending order of issues. | CREATE TABLE book (Title VARCHAR, Issues VARCHAR) |
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.icd9_code = "56210" | how many patients whose admission type is emergency and diagnoses icd9 code is 56210? | 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 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,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear 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
) |
SELECT COUNT(incumbent) FROM table_1341718_14 WHERE candidates = "Phil Crane (R) 58.0% Edward A. Warman (D) 42.0%" | how many times was the candidates phil crane (r) 58.0% edward a. warman (d) 42.0%? | CREATE TABLE table_1341718_14 (incumbent VARCHAR, candidates VARCHAR) |
SELECT Title FROM book WHERE Writer <> "Elaine Lee" | What are the titles of the books whose writer is not "Elaine Lee"? | CREATE TABLE book (Title VARCHAR, Writer VARCHAR) |
SELECT COUNT("Series Number") FROM table_45278 WHERE "Original Air Date" < '1999' AND "Number of Episodes" > '7' AND "DVD Region 1 release date" = '16 april 2013' | How many series originally aired before 1999 with more than 7 episodes and a DVD Region 1 release date of 16 april 2013? | CREATE TABLE table_45278 (
"Series Number" real,
"Number of Episodes" real,
"Original Air Date" real,
"DVD Region 2 release date" text,
"DVD Region 1 release date" text
) |
SELECT COUNT(candidates) FROM table_1341718_14 WHERE district = "Illinois 18" | how many times was it the district illinois 18? | CREATE TABLE table_1341718_14 (candidates VARCHAR, district VARCHAR) |
SELECT Title, Issues FROM book | What are the title and issues of the books? | CREATE TABLE book (Title VARCHAR, Issues VARCHAR) |
SELECT away FROM table_name_68 WHERE round = "q3" | What away is there for the q3 round? | CREATE TABLE table_name_68 (
away VARCHAR,
round VARCHAR
) |
SELECT candidates FROM table_1341718_14 WHERE incumbent = "Ed Derwinski" | who were the candidates when the incumbent was ed derwinski? | CREATE TABLE table_1341718_14 (candidates VARCHAR, incumbent VARCHAR) |
SELECT Publication_Date FROM publication ORDER BY Price DESC | What are the dates of publications in descending order of price? | CREATE TABLE publication (Publication_Date VARCHAR, Price VARCHAR) |
SELECT COUNT(*) FROM table_203_652 WHERE "score" = '1-0' | how many competitions had a score of 1-0 at most ? | CREATE TABLE table_203_652 (
id number,
"goal" number,
"date" text,
"venue" text,
"opponent" text,
"score" text,
"result" text,
"competition" text
) |
SELECT MIN(first_elected) FROM table_1341718_14 WHERE party = "Republican" AND candidates = "Robert H. Michel (R) 66.1% Rosa Lee Fox (D) 33.9%" | When was the first elected when the party was republican and the candidate were robert h. michel (r) 66.1% rosa lee fox (d) 33.9%? | CREATE TABLE table_1341718_14 (first_elected INTEGER, party VARCHAR, candidates VARCHAR) |
SELECT DISTINCT Publisher FROM publication WHERE Price > 5000000 | What are the distinct publishers of publications with price higher than 5000000? | CREATE TABLE publication (Publisher VARCHAR, Price INTEGER) |
SELECT COUNT("Silver") FROM table_66695 WHERE "Bronze" > '1' AND "Rank" < '5' | What is the total number of Silver for the Nation with more than 1 Bronze and a Rank less than 5? | CREATE TABLE table_66695 (
"Rank" real,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) |
SELECT incumbent FROM table_1341707_45 WHERE district = "Texas 15" | Who is the incumbent in district Texas 15? | CREATE TABLE table_1341707_45 (incumbent VARCHAR, district VARCHAR) |
SELECT Publisher FROM publication ORDER BY Price DESC LIMIT 1 | List the publisher of the publication with the highest price. | CREATE TABLE publication (Publisher VARCHAR, Price VARCHAR) |
SELECT "opponent#" FROM table_204_617 WHERE "date" > (SELECT "date" FROM table_204_617 WHERE "opponent#" = 'usc') ORDER BY "date" LIMIT 1 | who was the sooners opponent after usc ? | CREATE TABLE table_204_617 (
id number,
"date" text,
"opponent#" text,
"rank#" text,
"site" text,
"tv" text,
"result" text,
"attendance" number
) |
SELECT district FROM table_1341718_44 WHERE incumbent = "Earle Cabell" | Which district elected incumbent Earle Cabell? | CREATE TABLE table_1341718_44 (district VARCHAR, incumbent VARCHAR) |
SELECT Publication_Date FROM publication ORDER BY Price LIMIT 3 | List the publication dates of publications with 3 lowest prices. | CREATE TABLE publication (Publication_Date VARCHAR, Price VARCHAR) |
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'oxycodone (sustained release)' AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-1 year')) AS t1 JOIN (SELECT admissions.subject_id, prescriptions.drug, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-1 year')) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.startdate < t2.startdate AND DATETIME(t2.startdate) BETWEEN DATETIME(t1.startdate) AND DATETIME(t1.startdate, '+2 month') GROUP BY t2.drug) AS t3 WHERE t3.c1 <= 5 | list the top five most common drugs that patients were prescribed within 2 months after being prescribed oxycodone (sustained release) since 1 year ago. | CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
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 admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location text,
insurance text,
language text,
marital_status text,
ethnicity text,
age number
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
wardid number,
intime time,
outtime time
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name 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
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text,
first_wardid number,
last_wardid number,
intime time,
outtime time
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
) |
SELECT result FROM table_1341718_44 WHERE incumbent = "Ray Roberts" | What was the result when Ray Roberts was elected? | CREATE TABLE table_1341718_44 (result VARCHAR, incumbent VARCHAR) |
SELECT T1.Title, T2.Publication_Date FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID | Show the title and publication dates of books. | CREATE TABLE book (Title VARCHAR, Book_ID VARCHAR); CREATE TABLE publication (Publication_Date VARCHAR, Book_ID VARCHAR) |
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 (((flight.stops = 0) AND date_day.day_number = 27 AND date_day.month_number = 8 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code | list all flights on sunday from SAN FRANCISCO to PITTSBURGH nonstop | CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE airline (
airline_code varchar,
airline_name text,
note text
)
CREATE TABLE airport (
airport_code varchar,
airport_name text,
airport_location text,
state_code varchar,
country_name varchar,
time_zone_code varchar,
minimum_connect_time int
)
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,
flight_id int,
flight_number int,
from_airport varchar,
meal_code text,
stops int,
time_elapsed int,
to_airport varchar
)
CREATE TABLE city (
city_code varchar,
city_name varchar,
state_code varchar,
country_name varchar,
time_zone_code varchar
)
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE class_of_service (
booking_class varchar,
rank int,
class_description text
)
CREATE TABLE time_interval (
period text,
begin_time int,
end_time int
)
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
dual_airline varchar,
service_name text
)
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREATE TABLE flight_fare (
flight_id int,
fare_id int
)
CREATE TABLE equipment_sequence (
aircraft_code_sequence varchar,
aircraft_code varchar
)
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,
basic_type varchar,
engines int,
propulsion varchar,
wide_body varchar,
wing_span int,
length int,
weight int,
capacity int,
pay_load int,
cruising_speed int,
range_miles int,
pressurized varchar
)
CREATE TABLE food_service (
meal_code text,
meal_number int,
compartment text,
meal_description varchar
)
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 compartment_class (
compartment varchar,
class_type 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,
departure_flight_number int,
stop_time int
)
CREATE TABLE restriction (
restriction_code text,
advance_purchase int,
stopovers text,
saturday_stay_required text,
minimum_stay int,
maximum_stay int,
application text,
no_discounts text
)
CREATE TABLE days (
days_code varchar,
day_name varchar
)
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE fare (
fare_id int,
from_airport varchar,
to_airport varchar,
fare_basis_code text,
fare_airline text,
restriction_code text,
one_direction_cost int,
round_trip_cost int,
round_trip_required varchar
)
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minutes_distant int
) |
SELECT MAX(first_elected) FROM table_1341738_11 | What is the highest year that a candidate was first elected? | CREATE TABLE table_1341738_11 (first_elected INTEGER) |
SELECT T1.Writer FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID WHERE T2.Price > 4000000 | Show writers who have published a book with price more than 4000000. | CREATE TABLE publication (Book_ID VARCHAR, Price INTEGER); CREATE TABLE book (Writer VARCHAR, Book_ID VARCHAR) |
SELECT COUNT("Date") FROM table_29902 WHERE "High rebounds" = 'Marcus Camby (18)' | How many times was the high rebounds by marcus camby (18)? | CREATE TABLE table_29902 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) |
SELECT candidates FROM table_1341718_36 WHERE incumbent = "Bill Harsha" | Incumbent Bill Harsha was the winner in an election in which the candidates were who? | CREATE TABLE table_1341718_36 (candidates VARCHAR, incumbent VARCHAR) |
SELECT T1.Title FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID ORDER BY T2.Price DESC | Show the titles of books in descending order of publication price. | CREATE TABLE publication (Book_ID VARCHAR, Price VARCHAR); CREATE TABLE book (Title VARCHAR, Book_ID VARCHAR) |
SELECT "Shirt sponsor" FROM table_29469 WHERE "Head coach" = 'Samad Marfavi' | What sponsor has the head coach Samad Marfavi? | CREATE TABLE table_29469 (
"Team" text,
"Head coach" text,
"Team captain" text,
"Kit maker" text,
"Shirt sponsor" text,
"Past Season" text
) |
SELECT party FROM table_1341738_36 WHERE first_elected = 1954 | What was the party of the first elected candidate in 1954? | CREATE TABLE table_1341738_36 (party VARCHAR, first_elected VARCHAR) |
SELECT Publisher FROM publication GROUP BY Publisher HAVING COUNT(*) > 1 | Show publishers that have more than one publication. | CREATE TABLE publication (Publisher VARCHAR) |
SELECT demographic.dob, demographic.diagnosis FROM demographic WHERE demographic.name = "Brian Brock" | what is date of birth and primary disease of subject name brian brock? | CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
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 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 text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear 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
) |
SELECT COUNT(district) FROM table_1341738_36 WHERE incumbent = "Donald D. Clancy" | How many districts does Donald D. Clancy represent? | CREATE TABLE table_1341738_36 (district VARCHAR, incumbent VARCHAR) |
SELECT Publisher, COUNT(*) FROM publication GROUP BY Publisher | Show different publishers together with the number of publications they have. | CREATE TABLE publication (Publisher VARCHAR) |
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" GROUP BY date_of_enrolment ORDER BY date_of_enrolment DESC | Find the number of the enrollment date for all the tests that have 'Pass' result, and could you order x axis from high to low order please? | 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_Tests_Taken (
registration_id INTEGER,
date_test_taken DATETIME,
test_result VARCHAR(255)
)
CREATE TABLE Course_Authors_and_Tutors (
author_id INTEGER,
author_tutor_ATB VARCHAR(3),
login_name VARCHAR(40),
password VARCHAR(40),
personal_name VARCHAR(80),
middle_name VARCHAR(80),
family_name VARCHAR(80),
gender_mf VARCHAR(1),
address_line_1 VARCHAR(80)
)
CREATE TABLE Student_Course_Enrolment (
registration_id INTEGER,
student_id INTEGER,
course_id INTEGER,
date_of_enrolment DATETIME,
date_of_completion DATETIME
)
CREATE TABLE Courses (
course_id INTEGER,
author_id INTEGER,
subject_id INTEGER,
course_name VARCHAR(120),
course_description VARCHAR(255)
)
CREATE TABLE Subjects (
subject_id INTEGER,
subject_name VARCHAR(120)
) |
SELECT party FROM table_1341738_34 WHERE incumbent = "Lawrence H. Fountain" | Which party is Lawrence H. Fountain part of? | CREATE TABLE table_1341738_34 (party VARCHAR, incumbent VARCHAR) |
SELECT Publication_Date FROM publication GROUP BY Publication_Date ORDER BY COUNT(*) DESC LIMIT 1 | Please show the most common publication date. | CREATE TABLE publication (Publication_Date VARCHAR) |
SELECT "Opponent" FROM table_61636 WHERE "Arena" = 'honda center' AND "Date" = 'march 29' | What is the Opponent at the Honda Center on March 29? | CREATE TABLE table_61636 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" real,
"Record" text,
"Arena" text,
"Points" real
) |
SELECT first_elected FROM table_1341738_34 WHERE district = "North Carolina 8" | Who was the first person elected in North Carolina 8? | CREATE TABLE table_1341738_34 (first_elected VARCHAR, district VARCHAR) |
SELECT Writer FROM book GROUP BY Writer HAVING COUNT(*) > 1 | List the writers who have written more than one book. | CREATE TABLE book (Writer VARCHAR) |
SELECT nhl_team FROM table_2850912_10 WHERE player = "Ron Annear" | Which team drafted Ron Annear? | CREATE TABLE table_2850912_10 (
nhl_team VARCHAR,
player VARCHAR
) |
SELECT candidates FROM table_1341738_34 WHERE first_elected = "1952" AND party = "Democratic" | who was the candidate elected to the democratic party in 1952? | CREATE TABLE table_1341738_34 (candidates VARCHAR, first_elected VARCHAR, party VARCHAR) |
SELECT Title FROM book WHERE NOT Book_ID IN (SELECT Book_ID FROM publication) | List the titles of books that are not published. | CREATE TABLE book (Title VARCHAR, Book_ID VARCHAR); CREATE TABLE publication (Title VARCHAR, Book_ID VARCHAR) |
SELECT COUNT(wins) FROM table_name_13 WHERE podiums > 1 AND races = 9 AND season > 1984 | How many wins has a podiums greater than 1 and 9 as the races with a season after 1984? | CREATE TABLE table_name_13 (
wins VARCHAR,
season VARCHAR,
podiums VARCHAR,
races VARCHAR
) |
SELECT district FROM table_1341738_19 WHERE incumbent = "Joe Waggonner" | What district did Joe Waggonner belong to? | CREATE TABLE table_1341738_19 (district VARCHAR, incumbent VARCHAR) |
SELECT Publisher FROM publication WHERE Price > 10000000 INTERSECT SELECT Publisher FROM publication WHERE Price < 5000000 | Show the publishers that have publications with price higher than 10000000 and publications with price lower than 5000000. | CREATE TABLE publication (Publisher VARCHAR, Price INTEGER) |
SELECT COUNT("album") FROM table_204_244 | how many album entries are there ? | CREATE TABLE table_204_244 (
id number,
"year" number,
"album" text,
"peak\nus" number,
"peak\nus\nholiday" number,
"certifications\n(sales threshold)" text
) |
SELECT incumbent FROM table_1341738_19 WHERE first_elected = 1940 | What is the name of the incumbent who was first eleccted in 1940? | CREATE TABLE table_1341738_19 (incumbent VARCHAR, first_elected VARCHAR) |
SELECT COUNT(DISTINCT Publication_Date) FROM publication | What is the number of distinct publication dates? | CREATE TABLE publication (Publication_Date VARCHAR) |