table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
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 c... | how many hours has it been since the last hpt c w/o hepat coma nos diagnosis for patient 9964 on the current hospital visit? | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnoses_icd.charttime)) FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'hpt c w/o hepat coma nos') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM ad... |
CREATE TABLE table_67561 (
"Season" text,
"Player" text,
"Team" text,
"Position" text,
"Rating" text,
"Win #" text
) | What is the name of the team that had 1 win and a rating of +85? | SELECT "Team" FROM table_67561 WHERE "Win #" = '1' AND "Rating" = '+85' |
CREATE TABLE procedures (
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
)
... | what is the number of patients whose ethnicity is asian and admission year is less than 2107? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "ASIAN" AND demographic.admityear < "2107" |
CREATE TABLE table_48632 (
"Rank" real,
"Title" text,
"Studio" text,
"Director" text,
"Gross" text
) | What is the Studio of the Rank 10 Film? | SELECT "Studio" FROM table_48632 WHERE "Rank" = '10' |
CREATE TABLE table_70076 (
"Goal" text,
"Location" text,
"Lineup" text,
"Assist/pass" text,
"Score" text,
"Result" text,
"Competition" text
) | Which Assist/pass has a Goal of 5? | SELECT "Assist/pass" FROM table_70076 WHERE "Goal" = '5' |
CREATE TABLE table_name_40 (
date VARCHAR,
format VARCHAR
) | What date has the format of cd? | SELECT date FROM table_name_40 WHERE format = "cd" |
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... | count the number of patients with procedure icd9 code 5732 who were hospitalized for more than 4 days. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "4" AND procedures.icd9_code = "5732" |
CREATE TABLE Faculty_Participates_in (
FacID INTEGER,
actid INTEGER
)
CREATE TABLE Participates_in (
stuid INTEGER,
actid INTEGER
)
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
c... | How many faculty members do we have for each rank? Show bar chart, and could you show x axis in asc order? | SELECT Rank, COUNT(Rank) FROM Faculty GROUP BY Rank ORDER BY Rank |
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,
... | KML tag with language tags (rough estimate). | SELECT COUNT(DISTINCT P.Id) FROM Posts AS P INNER JOIN PostTags AS PT ON PT.PostId = P.Id INNER JOIN Tags AS T ON T.Id = PT.TagId INNER JOIN PostTags AS PT2 ON PT2.PostId = P.Id INNER JOIN Tags AS T2 ON T2.Id = PT2.TagId WHERE P.PostTypeId = 1 AND T.TagName = 'xml' AND T2.TagName IN ('javascript', 'android', 'java', 'p... |
CREATE TABLE table_66847 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" real,
"Record" text
) | What loss was against the angels with a 50-31 record? | SELECT "Loss" FROM table_66847 WHERE "Opponent" = 'angels' AND "Record" = '50-31' |
CREATE TABLE table_37510 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
) | What was the Result on November 9, 1958? | SELECT "Result" FROM table_37510 WHERE "Date" = 'november 9, 1958' |
CREATE TABLE table_name_48 (
driver VARCHAR,
race_2 VARCHAR
) | What is Driver, when Race 2 is 14? | SELECT driver FROM table_name_48 WHERE race_2 = "14" |
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 days of hospital stay is greater than 27 and lab test name is albumin, body fluid? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "27" AND lab.label = "Albumin, Body Fluid" |
CREATE TABLE table_204_238 (
id number,
"#" number,
"title" text,
"producer(s)" text,
"performer (s)" text,
"time" text
) | which is the shortest song ? | SELECT "title" FROM table_204_238 ORDER BY "time" LIMIT 1 |
CREATE TABLE procedures (
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
)
... | what is the number of patients whose admission location is emergency room admit with procedure oth cardiac mon output? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND procedures.short_title = "Oth cardiac mon output" |
CREATE TABLE table_79085 (
"Tie no" text,
"Home team" text,
"Score" text,
"Away team" text,
"Date" text
) | What was the score of the game against away team crewe alexandra? | SELECT "Score" FROM table_79085 WHERE "Away team" = 'crewe alexandra' |
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod... | how much changes in the weight of patient 28966 last measured on the last hospital visit compared to the second to last value measured on the last hospital visit? | SELECT (SELECT 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 = 28966 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)) AND ch... |
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,
... | what is the number of emergency room hospital admitted patients who were diagnosed with other malignant lymphomas, unspecified site, extranodal and solid organ sites? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.long_title = "Other malignant lymphomas, unspecified site, extranodal and solid organ sites" |
CREATE TABLE table_name_7 (
surface VARCHAR,
score VARCHAR
) | What type of surface was played on when the score was 2 6, 6 1, [10 5]? | SELECT surface FROM table_name_7 WHERE score = "2–6, 6–1, [10–5]" |
CREATE TABLE table_name_38 (
engine VARCHAR,
year VARCHAR,
points VARCHAR,
chassis VARCHAR
) | Name the engine when points are 0 and chassis is kuzma indy roadster for 1954 | SELECT engine FROM table_name_38 WHERE points = 0 AND chassis = "kuzma indy roadster" AND year = 1954 |
CREATE TABLE table_12251936_1 (
tfr_2006 VARCHAR,
gfr_2006 VARCHAR
) | How many TFR were there in 2006 when the GFR was 53.8? | SELECT tfr_2006 FROM table_12251936_1 WHERE gfr_2006 = "53.8" |
CREATE TABLE Orders (
order_id INTEGER,
customer_id INTEGER,
date_order_placed DATETIME,
order_details VARCHAR(255)
)
CREATE TABLE Accounts (
account_id INTEGER,
customer_id INTEGER,
date_account_opened DATETIME,
account_name VARCHAR(50),
other_account_details VARCHAR(255)
)
CREATE... | What are total transaction amounts for each transaction type, and show transaction_type in asc order. | SELECT transaction_type, SUM(transaction_amount) FROM Financial_Transactions GROUP BY transaction_type ORDER BY transaction_type |
CREATE TABLE table_name_99 (
venue VARCHAR,
away_team VARCHAR
) | In the game where richmond was the away team, what venue was it played at? | SELECT venue FROM table_name_99 WHERE away_team = "richmond" |
CREATE TABLE table_23492 (
"Ostrich" text,
"Hamerkop" text,
"Hadeda Ibis" text,
"African Spoonbill" text,
"Whitefaced Duck" text,
"Knobbilled Duck" text
) | What is the African Spoonbill when the Hadeda Ibis is the Brown Snake Eagle? | SELECT "African Spoonbill" FROM table_23492 WHERE "Hadeda Ibis" = 'Brown Snake Eagle' |
CREATE TABLE table_17292 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Series" text
) | Who did the high points of game 5? | SELECT "High points" FROM table_17292 WHERE "Game" = '5' |
CREATE TABLE table_8995 (
"Place" text,
"Player" text,
"Country" text,
"Score" real,
"To par" text
) | What was Ben Hogan's par? | SELECT "To par" FROM table_8995 WHERE "Player" = 'ben hogan' |
CREATE TABLE table_16164 (
"Season" real,
"Premier" text,
"Runner-up" text,
"Score" text,
"Margin" real,
"Venue" text,
"Attendance" real
) | what's the minimum attendance with score 10.16 (76) 9.22 (76) | SELECT MIN("Attendance") FROM table_16164 WHERE "Score" = '10.16 (76) – 9.22 (76)' |
CREATE TABLE table_46035 (
"Game" real,
"February" real,
"Opponent" text,
"Score" text,
"Record" text
) | What is the number of the game when the opponent was the New York Islanders, and a February less than 24? | SELECT SUM("Game") FROM table_46035 WHERE "Opponent" = 'new york islanders' AND "February" < '24' |
CREATE TABLE table_50170 (
"Cartridge" text,
"Bullet weight" text,
"Muzzle velocity" text,
"Muzzle energy" text,
"Max pressure" text
) | What is the muzzle velocity for the .38 long colt cartridge? | SELECT "Muzzle velocity" FROM table_50170 WHERE "Cartridge" = '.38 long colt' |
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, draw a bar chart about the distribution of founder and the sum of manufacturer , and group by attribute founder. | SELECT Founder, SUM(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder |
CREATE TABLE table_23612439_2 (
opponent VARCHAR,
date VARCHAR
) | Which opponents are on the date September 5? | SELECT opponent FROM table_23612439_2 WHERE date = "September 5" |
CREATE TABLE pitStops (
raceId INTEGER,
driverId INTEGER,
stop INTEGER,
lap INTEGER,
time TEXT,
duration TEXT,
milliseconds INTEGER
)
CREATE TABLE drivers (
driverId INTEGER,
driverRef TEXT,
number TEXT,
code TEXT,
forename TEXT,
surname TEXT,
dob TEXT,
natio... | Find the names of Japanese constructors that have once earned more than 5 points, and count them by a pie chart | SELECT name, COUNT(name) FROM constructors AS T1 JOIN constructorStandings AS T2 ON T1.constructorId = T2.constructorId WHERE T1.nationality = "Japanese" AND T2.points > 5 GROUP BY name |
CREATE TABLE table_52342 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | what is the grid when the time/retired is oil pressure and the laps are more than 50? | SELECT AVG("Grid") FROM table_52342 WHERE "Time/Retired" = 'oil pressure' AND "Laps" > '50' |
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 d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE d_i... | what are the four most frequent intakes in 2100? | SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT inputevents_cv.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM inputevents_cv WHERE STRFTIME('%y', inputevents_cv.charttime) = '2100' GROUP BY inputevents_cv.itemid) AS t1 WHERE t1.c1 <= 4) |
CREATE TABLE Person (
name VARCHAR
)
CREATE TABLE PersonFriend (
name VARCHAR
) | Find Alice's friends of friends. | SELECT DISTINCT T4.name FROM PersonFriend AS T1 JOIN Person AS T2 ON T1.name = T2.name JOIN PersonFriend AS T3 ON T1.friend = T3.name JOIN PersonFriend AS T4 ON T3.friend = T4.name WHERE T2.name = 'Alice' AND T4.name <> 'Alice' |
CREATE TABLE table_1218 (
"Municipality" text,
"League of Communists" real,
"Peoples Party" real,
"Union of Reform Forces" real,
"Democratic Coalition" real,
"DSSP" real,
"Total seats" real
) | How many league of communists have the people's party at 7? | SELECT COUNT("League of Communists") FROM table_1218 WHERE "Peoples Party" = '7' |
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,
... | how many days has passed since the last time patient 027-151154 has had a procedure in the current hospital visit? | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-151154... |
CREATE TABLE table_name_11 (
result VARCHAR,
venue VARCHAR
) | What is the result in oakland? | SELECT result FROM table_name_11 WHERE venue = "oakland" |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetake... | what were the top three most frequent medications that followed in the same month for the patients who took the hormonal therapy (for varices) - octreotide in the previous year? | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'hormonal therapy (for varices) - octreotide' AND D... |
CREATE TABLE table_27437601_2 (
original_air_date VARCHAR,
no_in_season VARCHAR
) | List the 1st air date for season 12. | SELECT original_air_date FROM table_27437601_2 WHERE no_in_season = 12 |
CREATE TABLE table_name_54 (
time VARCHAR,
nationality VARCHAR
) | What is the time for Russia? | SELECT time FROM table_name_54 WHERE nationality = "russia" |
CREATE TABLE table_24136365_2 (
location VARCHAR,
week VARCHAR
) | When 4 is the week what is the location? | SELECT location FROM table_24136365_2 WHERE week = 4 |
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 ... | how much does patient 14982 change in heart rate last measured on the last icu visit compared to the first value measured on the last icu visit? | SELECT (SELECT 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 = 14982) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents... |
CREATE TABLE table_14304 (
"Rank by average" real,
"Competition finish" real,
"Couple" text,
"Total" real,
"Number of dances" real,
"Average" real
) | Name the total number of competition finish with total of 90 and rank by average more than 5 | SELECT COUNT("Competition finish") FROM table_14304 WHERE "Total" = '90' AND "Rank by average" > '5' |
CREATE TABLE PostTypes (
Id number,
Name text
)
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,
ProfileImage... | create while loop with cte. http://stackoverflow.com/questions/12929165/create-while-loop-with-cte | WITH Nums AS (SELECT Digit FROM (VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9)) AS Nums(Digit)) SELECT CAST(id AS TEXT(5)) AS id FROM (SELECT t3.digit * 100 + t2.digit * 10 + t1.digit + 1 AS id FROM Nums AS t1 CROSS JOIN Nums AS t2 CROSS JOIN Nums AS t3) AS t WHERE id <= 884 ORDER BY id |
CREATE TABLE bridge (
length_feet INTEGER
) | What is the average length in feet of the bridges? | SELECT AVG(length_feet) FROM bridge |
CREATE TABLE table_1137707_2 (
location VARCHAR,
fastest_lap VARCHAR
) | What is the location of thierry boutsen? | SELECT location FROM table_1137707_2 WHERE fastest_lap = "Thierry Boutsen" |
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... | How many accounts are opened in each day for all accounts by the customer with first name 'Meaghan' ? Bin the account open day by weekday in a bar chart, and order y axis in ascending order. | SELECT date_account_opened, COUNT(date_account_opened) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan' ORDER BY COUNT(date_account_opened) |
CREATE TABLE table_train_116 (
"id" int,
"mini_mental_state_examination_mmse" int,
"hemoglobin_a1c_hba1c" float,
"body_weight" float,
"hepatic_disease" bool,
"geriatric_depression_scale_gds" int,
"NOUSE" float
) | screening geriatric depression ( gds ) _ 15 score less than ( < ) 6 | SELECT * FROM table_train_116 WHERE geriatric_depression_scale_gds <= 6 |
CREATE TABLE diagnoses (
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 prescriptions... | what is the number of patients whose admission location is trsf within this facility and year of birth is less than 1887? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.dob_year < "1887" |
CREATE TABLE Invoices (
invoice_number INTEGER,
order_id INTEGER,
invoice_date DATETIME
)
CREATE TABLE Product_Categories (
production_type_code VARCHAR(15),
product_type_description VARCHAR(80),
vat_rating DECIMAL(19,4)
)
CREATE TABLE Financial_Transactions (
transaction_id INTEGER,
a... | What is the relationship between account id and the number of transactions for each account? Return a scatter chart. | SELECT T1.account_id, COUNT(*) FROM Financial_Transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id |
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,
... | what number of patients admitted in emergency had drug code enox80i? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND prescriptions.formulary_drug_cd = "ENOX80I" |
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... | get the number of patients with procedure icd9 code 4439. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.icd9_code = "4439" |
CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE flight_fare (
flight_id int,
fare_id int
)
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
... | please give me flights from ATLANTA to BOSTON on wednesday morning and thursday afternoon | 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.departure_time BETWEEN 0 AND 1200) AND date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year = 1991 AND days.day_na... |
CREATE TABLE table_name_60 (
pick INTEGER,
team VARCHAR
) | What is the lowest pick for the Buffalo Bills? | SELECT MIN(pick) FROM table_name_60 WHERE team = "buffalo bills" |
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE area (
course_id int,
area varchar
)
CREATE TABLE offering_instructor (
offering_ins... | For Winter Other classes who is the professor ? | SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instr... |
CREATE TABLE table_name_82 (
game VARCHAR,
rams_points VARCHAR
) | In what Game did Rams Points equal 0? | SELECT game FROM table_name_82 WHERE rams_points = 0 |
CREATE TABLE store_district (
Store_ID int,
District_ID int
)
CREATE TABLE product (
product_id int,
product text,
dimensions text,
dpi real,
pages_per_minute_color real,
max_page_size text,
interface text
)
CREATE TABLE store (
Store_ID int,
Store_Name text,
Type text,... | What are the district names and city populations for all districts that between 200,000 and 2,000,000 residents? Show a bar graph, and rank in desc by the X. | SELECT District_name, City_Population FROM district WHERE City_Population BETWEEN 200000 AND 2000000 ORDER BY District_name DESC |
CREATE TABLE table_11190568_7 (
date_of_vacancy VARCHAR,
outgoing_manager VARCHAR
) | When are the vacancy dates for outgoing manager Damien Fox? | SELECT date_of_vacancy FROM table_11190568_7 WHERE outgoing_manager = "Damien Fox" |
CREATE TABLE table_name_50 (
type VARCHAR,
name__pinyin_ VARCHAR
) | What is the type of Guangjia? | SELECT type FROM table_name_50 WHERE name__pinyin_ = "guangjia" |
CREATE TABLE Person (
name varchar(20),
age INTEGER,
city TEXT,
gender TEXT,
job TEXT
)
CREATE TABLE PersonFriend (
name varchar(20),
friend varchar(20),
year INTEGER
) | what is minimum age for different job title?, and list by the job in desc. | SELECT job, MIN(age) FROM Person GROUP BY job ORDER BY job DESC |
CREATE TABLE table_16077 (
"Round" real,
"Choice" real,
"Overall" real,
"Player name" text,
"Position" text,
"College" text
) | What is Bruce Cerone overall? | SELECT MIN("Overall") FROM table_16077 WHERE "Player name" = 'Bruce Cerone' |
CREATE TABLE table_42144 (
"Call sign" text,
"Frequency MHz" real,
"City of license" text,
"ERP W" real,
"Class" text,
"FCC info" text
) | What's the Class for the city the license plate was issued in great barrington, massachusetts? | SELECT "Class" FROM table_42144 WHERE "City of license" = 'great barrington, massachusetts' |
CREATE TABLE table_name_98 (
format VARCHAR,
label VARCHAR
) | What is Candlelight Records format? | SELECT format FROM table_name_98 WHERE label = "candlelight records" |
CREATE TABLE table_name_19 (
district VARCHAR,
reserved_for___sc___st__none_ VARCHAR,
constituency_number VARCHAR
) | Name the District that has a Reserved for ( SC / ST /None) of none and a Constituency number of 242? | SELECT district FROM table_name_19 WHERE reserved_for___sc___st__none_ = "none" AND constituency_number = "242" |
CREATE TABLE table_22810 (
"Year" real,
"Starts" real,
"Wins" real,
"Top 5" real,
"Top 10" real,
"Poles" real,
"Avg. Start" text,
"Avg. Finish" text,
"Winnings" text,
"Position" text,
"Team(s)" text
) | What's the amount of winnings (in $) in the year with 2 wins? | SELECT "Winnings" FROM table_22810 WHERE "Wins" = '2' |
CREATE TABLE table_54562 (
"Name" text,
"Current version" text,
"System" text,
"Platform" text,
"License" text
) | What platform is nds4droid on for the nintendo ds with a license of gpl v2? | SELECT "Platform" FROM table_54562 WHERE "System" = 'nintendo ds' AND "License" = 'gpl v2' AND "Name" = 'nds4droid' |
CREATE TABLE table_name_18 (
score VARCHAR,
record VARCHAR
) | What was the score of the game with a record of 18-22-13? | SELECT score FROM table_name_18 WHERE record = "18-22-13" |
CREATE TABLE apartments (
apt_id number,
building_id number,
apt_type_code text,
apt_number text,
bathroom_count number,
bedroom_count number,
room_count text
)
CREATE TABLE apartment_facilities (
apt_id number,
facility_code text
)
CREATE TABLE apartment_buildings (
building_i... | Which apartments have type code 'Flat'? Give me their apartment numbers. | SELECT apt_number FROM apartments WHERE apt_type_code = "Flat" |
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,
IsHidden boolean,
Predefined boolean,
PostNoticeDurationId number
)
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
Owner... | Top 50 SO Users from Madhya Pradesh. | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, Location FROM Users WHERE LOWER(Location) LIKE '%Madhya pradesh%' OR UPPER(Location) LIKE '%Madhya pradesh%' OR Location LIKE '%Madhya pradesh%' AND Reputation >= 1000 ORDER BY Reputation DESC LIMIT 2500 |
CREATE TABLE table_79086 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Results" text
) | What are the results of the incumbent who was first elected in 1996? | SELECT "Results" FROM table_79086 WHERE "First elected" = '1996' |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
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,... | how much weight was patient 739's last weight in this month? | SELECT 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 = 739)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt' A... |
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... | Return a bar chart about the distribution of ACC_Road and School_ID , and group by attribute All_Home, and rank by the x axis in desc please. | SELECT ACC_Road, School_ID FROM basketball_match GROUP BY All_Home, ACC_Road ORDER BY ACC_Road DESC |
CREATE TABLE table_64522 (
"Position" real,
"Name" text,
"Played" real,
"Drawn" real,
"Lost" real,
"Points" real
) | What is the total number of points combined from the teams that played over 14 games? | SELECT COUNT("Points") FROM table_64522 WHERE "Played" > '14' |
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE jo... | Does Prof. Bradley Smith teach 475 next Winter ? | SELECT COUNT(*) > 0 FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 475 AND instructor.name LIKE '%Bradley Smith%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_i... |
CREATE TABLE table_train_215 (
"id" int,
"hemoglobin_a1c_hba1c" float,
"hgba1c" float,
"estimated_glomerular_filtration_rate_egfr" int,
"kidney_disease" bool,
"body_mass_index_bmi" float,
"age" float,
"NOUSE" float
) | hemoglobin a1c < 8.5 % | SELECT * FROM table_train_215 WHERE hemoglobin_a1c_hba1c < 8.5 |
CREATE TABLE table_34384 (
"Rank" real,
"Name" text,
"Nation" text,
"Points" real,
"Places" real
) | What was the average rank of Wolfgang Schwarz with greater than 13 places? | SELECT AVG("Rank") FROM table_34384 WHERE "Name" = 'wolfgang schwarz' AND "Places" > '13' |
CREATE TABLE table_71074 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text,
"Money ( $ )" real
) | what is the place for ireland? | SELECT "Place" FROM table_71074 WHERE "Country" = 'ireland' |
CREATE TABLE table_14292 (
"Pick" real,
"Player" text,
"Country of origin*" text,
"PBA team" text,
"College" text
) | What is the country of origin for the player who plays on Tondena 65 Rhum? | SELECT "Country of origin*" FROM table_14292 WHERE "PBA team" = 'tondena 65 rhum' |
CREATE TABLE table_21146729_6 (
series__number INTEGER,
original_airdate VARCHAR
) | What was the series# with the original airdate of october 23, 1967? | SELECT MAX(series__number) FROM table_21146729_6 WHERE original_airdate = "October 23, 1967" |
CREATE TABLE table_60132 (
"Year" real,
"Competition" text,
"Venue" text,
"Position" text,
"Event" text,
"Time" text
) | What Competition has a Year smaller than 1983? | SELECT "Competition" FROM table_60132 WHERE "Year" < '1983' |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions... | provide the number of patients whose admission type is newborn and drug route is neb? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "NEWBORN" AND prescriptions.route = "NEB" |
CREATE TABLE table_204_749 (
id number,
"courthouse" text,
"city" text,
"street address" text,
"jurisdiction" text,
"dates of use" text,
"named for" number
) | where was the first court house built ? | SELECT "city" FROM table_204_749 ORDER BY "dates of use" LIMIT 1 |
CREATE TABLE table_1074 (
"Nation" text,
"Winners" real,
"Runners-up" real,
"Third Place" real,
"Fourth Place" real
) | How many times did argentina win? | SELECT MAX("Winners") FROM table_1074 WHERE "Nation" = 'Argentina' |
CREATE TABLE table_name_23 (
runner_s__up VARCHAR,
winner VARCHAR
) | Who was the runner(s)-Up to winner Sarah Brice? | SELECT runner_s__up FROM table_name_23 WHERE winner = "sarah brice" |
CREATE TABLE table_203_697 (
id number,
"player" text,
"career" text,
"nickname" text,
"team inducted as" text
) | how long did cap anson play ? | SELECT "career" - "career" FROM table_203_697 WHERE "player" = 'cap anson' |
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 the number of patients who were admitted via emergency room and had open liver biopsy procedure? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND procedures.short_title = "Open liver biopsy" |
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 inputevents_cv (
row_id number,
subject_id number,
... | until 2104, when did patient 86206 come to the hospital via the phys referral/normal deli for the first time? | SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 86206 AND admissions.admission_location = 'phys referral/normal deli' AND STRFTIME('%y', admissions.admittime) <= '2104' ORDER BY admissions.admittime LIMIT 1 |
CREATE TABLE table_37033 (
"Player" text,
"Country" text,
"Year(s) won" text,
"Total" real,
"To par" real,
"Finish" text
) | Year(s) won of 1994 , 1997 has what average total? | SELECT AVG("Total") FROM table_37033 WHERE "Year(s) won" = '1994 , 1997' |
CREATE TABLE table_name_44 (
date VARCHAR,
home_team VARCHAR
) | When was Southend United the home team? | SELECT date FROM table_name_44 WHERE home_team = "southend united" |
CREATE TABLE table_56435 (
"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,
"2004" text... | what 1989 has 2002 of 4r and 2005 of 4r? | SELECT "1989" FROM table_56435 WHERE "2002" = '4r' AND "2005" = '4r' |
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 gsi (
course_offering_id int,
student_id int
)
CREATE TABLE instructor (
... | Which classes make up an EECS major 's Core ? | SELECT DISTINCT course.department, course.name, course.number FROM course, program_course WHERE course.department LIKE '%EECS%' AND program_course.category LIKE '%Core%' AND program_course.course_id = course.course_id |
CREATE TABLE table_name_21 (
year INTEGER,
miss_fire__3rd_runner_up_ VARCHAR
) | What year was Caroline Medina Miss Fire (3rd Runner-up)? | SELECT AVG(year) FROM table_name_21 WHERE miss_fire__3rd_runner_up_ = "caroline medina" |
CREATE TABLE has_amenity (
dormid number,
amenid number
)
CREATE TABLE dorm (
dormid number,
dorm_name text,
student_capacity number,
gender text
)
CREATE TABLE dorm_amenity (
amenid number,
amenity_name text
)
CREATE TABLE lives_in (
stuid number,
dormid number,
room_numb... | What is the first name and age of every student who lives in a dorm with a TV Lounge? | SELECT T1.fname, T1.age FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE NOT T2.dormid IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge') |
CREATE TABLE table_name_5 (
crowd VARCHAR,
away_team VARCHAR
) | How many people were in the crowd with the away team being collingwood? | SELECT COUNT(crowd) FROM table_name_5 WHERE away_team = "collingwood" |
CREATE TABLE ReviewTaskStates (
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 TA... | Questions with outstanding close votes by tag. | SELECT * FROM (SELECT Posts.Id AS "post_link", AVG(Posts.Score) AS "score", COUNT(*) AS "close_votes", MAX(Votes.CreationDate) AS "last_vote", MIN(Votes.CreationDate) AS "first_vote" FROM Posts JOIN Votes ON Posts.Id = Votes.PostId WHERE Votes.VoteTypeId = 6 AND Posts.ClosedDate IS NULL AND Posts.Tags LIKE '%<##Tag##>%... |
CREATE TABLE table_20124413_1 (
original_title VARCHAR,
prod_code VARCHAR
) | When 1.12 is the production code what is the original title? | SELECT original_title FROM table_20124413_1 WHERE prod_code = "1.12" |
CREATE TABLE table_1692 (
"Province" text,
"Provincial capital" text,
"Largest city" text,
"Area (km 2 )" real,
"Population (2013)" real
) | what is the number of provincial captial where the province is northern cape? | SELECT COUNT("Provincial capital") FROM table_1692 WHERE "Province" = 'Northern Cape' |
CREATE TABLE table_8650 (
"Game" real,
"Date" text,
"Opponent" text,
"Score" text,
"Location" text,
"Attendance" real,
"Record" text,
"Points" real
) | How many Points have a Date of march 19, 2009? | SELECT COUNT("Points") FROM table_8650 WHERE "Date" = 'march 19, 2009' |
CREATE TABLE table_26137 (
"Series episode" real,
"Season episode" real,
"Title" text,
"U.S. viewers (millions)" text,
"Original U.S. airdate" text,
"Prod. code" real
) | What is the lowest series episode with a production code of 406? | SELECT MIN("Series episode") FROM table_26137 WHERE "Prod. code" = '406' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.