table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | Posts edited by the user, excluding own posts. | SELECT h.PostId AS "post_link", h.CreationDate AS "edit_date" FROM PostHistory AS h, Posts AS p WHERE h.UserId = '##UserID##' AND h.PostHistoryTypeId IN (4, 5, 6) AND p.Id = h.PostId AND p.OwnerUserId != '##UserID##' ORDER BY 'edit_date' DESC |
CREATE TABLE table_203_554 (
id number,
"year" number,
"place" text,
"gold" text,
"silver" text,
"bronze" text
) | what is the number of total bronze medals that germany has won ? | SELECT COUNT(*) FROM table_203_554 WHERE "bronze" = 'germany' |
CREATE TABLE table_20975 (
"Game" real,
"Date" text,
"Opponent" text,
"Result" text,
"Falcons points" real,
"Opponents" real,
"Record" text,
"Attendance" real
) | Name the date for game 9 | SELECT "Date" FROM table_20975 WHERE "Game" = '9' |
CREATE TABLE table_78304 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
) | What sum of Attendance has a Week smaller than 10, and a Result of l 30-21? | SELECT SUM("Attendance") FROM table_78304 WHERE "Week" < '10' AND "Result" = 'l 30-21' |
CREATE TABLE table_name_52 (
manager VARCHAR,
manufacturer VARCHAR,
club VARCHAR
) | What Premier League Manager has an Adidas sponsor and a Newcastle United club? | SELECT manager FROM table_name_52 WHERE manufacturer = "adidas" AND club = "newcastle united" |
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 of hispano/latino - puerto rican ethnicity have been prescribed the drug sulfamethoxazole - trimethoprim? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND prescriptions.drug = "Sulfamethoxazole-Trimethoprim" |
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE ReviewTaskSt... | Low views, high votes yet unanswered. A list of questions with a high score and low view count | SELECT questao.Id AS "post_link", questao.Score, questao.ViewCount, comentario.Id, comentario.Score AS socre_comentario, comentario.ViewCount AS views_comentario FROM Posts AS questao JOIN Posts AS comentario ON questao.Id = comentario.ParentId WHERE questao.Tags LIKE '%<android%' AND questao.ParentId IS NULL ORDER BY ... |
CREATE TABLE table_56514 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | If essendon is the home team, what venue did they play at? | SELECT "Venue" FROM table_56514 WHERE "Home team" = 'essendon' |
CREATE TABLE table_6915 (
"Name" text,
"Novelty" text,
"Status" text,
"Authors" text,
"Unit" text,
"Location" text
) | Which Status has a Unit of daohugou beds? | SELECT "Status" FROM table_6915 WHERE "Unit" = 'daohugou beds' |
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CRE... | Posts containing bit.ly shortened URLs. Posts containing bit.ly shortened URLs, which allow for tracking clicks :-(
See http://meta.stackoverflow.com/questions/29518/can-and-should-stack-overflow-automatically-rewrite-bit-ly-links
See http://stackapps.com/questions/121/what-ideas-do-you-have-for-the-api/546#546 | SELECT Id AS "post_link", Body FROM Posts WHERE Body LIKE '%http://bit.ly%' |
CREATE TABLE table_17166 (
"Series" text,
"Monday" text,
"Tuesday" text,
"Wednesday" text,
"Thursday" text,
"Friday" text,
"Saturday" text,
"Sunday" text
) | Who is the Wednesday presenter of the show Big Brother 13? | SELECT "Wednesday" FROM table_17166 WHERE "Series" = 'Big Brother 13' |
CREATE TABLE table_name_2 (
right_ascension___j2000__ VARCHAR,
ngc_number VARCHAR,
object_type VARCHAR,
apparent_magnitude VARCHAR
) | Tell me the right ascensuon for object type of globular cluster and apparent magnitude of 8.5 and NGC number of 6273 | SELECT right_ascension___j2000__ FROM table_name_2 WHERE object_type = "globular cluster" AND apparent_magnitude = 8.5 AND ngc_number = 6273 |
CREATE TABLE table_name_47 (
competition VARCHAR,
date VARCHAR
) | Which competition was on 17/9/00? | SELECT competition FROM table_name_47 WHERE date = "17/9/00" |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartr... | had patient 022-6959 excreted any urine in this month? | SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-6959')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput... |
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),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25... | For those employees who do not work in departments with managers that have ids between 100 and 200, give me the trend about employee_id over hire_date , show X in descending order. | 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 DESC |
CREATE TABLE table_name_59 (
catalog VARCHAR,
region VARCHAR
) | What is the Catalog Number is for the Japan region? | SELECT catalog FROM table_name_59 WHERE region = "japan" |
CREATE TABLE table_35704 (
"Source" text,
"Date" text,
"Fidesz" text,
"MSZP" text,
"SZDSZ" text,
"Jobbik" text,
"others" text
) | What is the SZDSZ percentage with an MSZP of 25% on 25/2/2009? | SELECT "SZDSZ" FROM table_35704 WHERE "MSZP" = '25%' AND "Date" = '25/2/2009' |
CREATE TABLE table_name_45 (
set_2 VARCHAR,
date VARCHAR,
set_3 VARCHAR
) | Which Set 2 has a Date of 25 may, and a Set 3 of 21 25? | SELECT set_2 FROM table_name_45 WHERE date = "25 may" AND set_3 = "21–25" |
CREATE TABLE Rooms (
roomName VARCHAR,
RoomId VARCHAR
)
CREATE TABLE Reservations (
Room VARCHAR
) | Return the name and number of reservations made for each of the rooms. | SELECT T2.roomName, COUNT(*), T1.Room FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room |
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAd... | Top 100 android users from Pakistan. | WITH USER_BY_TAG AS (SELECT ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS Rank, u.Id AS "user_link", COUNT(*) AS UpVotes FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON p.ParentId = pt.PostId INNER JOIN Votes AS v ON v.PostId = p.Id AND VoteTypeId = 2 INNER JOIN Users AS u ON u.Id =... |
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total_gpa float,
entered_as ... | Next semester , which upper level elective classes only meet Monday , Tuesday , Wednesday and / or Thursday ? | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course_offering.friday = 'N' AND course.course_id = course_offering.course_id AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'FA' ... |
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,
... | give me the number of patients whose insurance is government and diagnoses icd9 code is 78720? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Government" AND diagnoses.icd9_code = "78720" |
CREATE TABLE Fault_Log (
fault_log_entry_id INTEGER,
asset_id INTEGER,
recorded_by_staff_id INTEGER,
fault_log_entry_datetime DATETIME,
fault_description VARCHAR(255),
other_fault_details VARCHAR(255)
)
CREATE TABLE Skills_Required_To_Fix (
part_fault_id INTEGER,
skill_id INTEGER
)
CRE... | How many staffs have contacted with each engineer? Give me a bar chart grouping by each engineer's last name, display in asc by the x-axis. | SELECT last_name, COUNT(last_name) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id JOIN Maintenance_Engineers AS T3 ON T2.engineer_id = T3.engineer_id GROUP BY last_name ORDER BY last_name |
CREATE TABLE table_49753 (
"City" text,
"Country" text,
"IATA" text,
"ICAO" text,
"Airport" text
) | What is the airport when the iata is tbj? | SELECT "Airport" FROM table_49753 WHERE "IATA" = 'tbj' |
CREATE TABLE table_18534 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Result" text,
"Candidates" text
) | What is the party where the incumbent is overton brooks? | SELECT "Party" FROM table_18534 WHERE "Incumbent" = 'Overton Brooks' |
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
dual_airline varchar,
service_name text
)
CREATE TABLE class_of_service (
booking_class varchar,
rank int,
class_description text
)
CREATE TABLE airport (
airport_code varchar,
airp... | can you tell me the time a flight would leave from ATLANTA to BOSTON in the afternoon | SELECT DISTINCT flight.departure_time FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = '... |
CREATE TABLE table_33011 (
"Region" text,
"Host" text,
"Venue" text,
"City" text,
"State" text
) | What Venue is in Colorado? | SELECT "Venue" FROM table_33011 WHERE "State" = 'colorado' |
CREATE TABLE table_20898602_1 (
position VARCHAR,
height VARCHAR
) | what is the position of the player of height ft0in (m) | SELECT position FROM table_20898602_1 WHERE height = "ft0in (m)" |
CREATE TABLE table_5301 (
"Episode No." text,
"Episode Title" text,
"UK Broadcast Date" text,
"Presenter" text,
"Countries Visited" text
) | What is the broadcast date for the episode titled, 'From Hong Kong to Ulaanbaatar'? | SELECT "UK Broadcast Date" FROM table_5301 WHERE "Episode Title" = 'from hong kong to ulaanbaatar' |
CREATE TABLE table_name_99 (
bullet_weight VARCHAR,
source VARCHAR
) | What is Bullet weight, when Source is hornady? | SELECT bullet_weight FROM table_name_99 WHERE source = "hornady" |
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25),
COUNTRY_ID varchar(2)
)
CREATE T... | For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of hire_date and the average of employee_id bin hire_date by weekday, and I want to rank by the total number in asc. | SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(EMPLOYEE_ID) |
CREATE TABLE table_29779 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | What were the high points on April 8? | SELECT "High points" FROM table_29779 WHERE "Date" = 'April 8' |
CREATE TABLE table_name_86 (
player VARCHAR,
position VARCHAR
) | Who has a position of sg? | SELECT player FROM table_name_86 WHERE position = "sg" |
CREATE TABLE table_63559 (
"Rank" real,
"Lane" real,
"Athlete" text,
"Nationality" text,
"Time" real,
"React" real
) | What is Christian Malcolm s highest react when his time was below 20.58? | SELECT MAX("React") FROM table_63559 WHERE "Time" < '20.58' AND "Athlete" = 'christian malcolm' |
CREATE TABLE table_1341690_35 (
candidates VARCHAR,
first_elected VARCHAR
) | Who were the candidates in the districts that was first elected in 1966? | SELECT candidates FROM table_1341690_35 WHERE first_elected = 1966 |
CREATE TABLE table_26400438_1 (
series VARCHAR,
team VARCHAR
) | In which series did Lecor Sports participate? | SELECT series FROM table_26400438_1 WHERE team = "Lecor Sports" |
CREATE TABLE table_14086 (
"Year(s)" real,
"Tournament or series" text,
"Played in" text,
"Games played ( Tests )" text,
"Games won ( Tests )" text,
"Games lost ( Tests )" text,
"Games drawn ( Tests )" text,
"Points for ( Tests )" text,
"Points against ( Tests )" text
) | What are the points against for 2000, when games won is 4 (1)? | SELECT "Points against ( Tests )" FROM table_14086 WHERE "Year(s)" = '2000' AND "Games won ( Tests )" = '4 (1)' |
CREATE TABLE table_name_2 (
musical_guest__song_performed_ VARCHAR,
air_date VARCHAR
) | What is the Musical Guest (Song performed) for the episode aired on 13 july 2008? | SELECT musical_guest__song_performed_ FROM table_name_2 WHERE air_date = "13 july 2008" |
CREATE TABLE repair (
repair_ID int,
name text,
Launch_Date text,
Notes text
)
CREATE TABLE technician (
technician_id real,
Name text,
Team text,
Starting_Year real,
Age int
)
CREATE TABLE machine (
Machine_ID int,
Making_Year int,
Class text,
Team text,
Machin... | Create a bar chart showing the total number across team | SELECT Team, COUNT(*) FROM technician GROUP BY Team |
CREATE TABLE table_25212 (
"District name" text,
"Dist. ID" real,
"ISD" text,
"County" text,
"Authorizing agency" text,
"Date opened" text,
"Services" text
) | If the name of the district is the Charyl Stockwell Academy, what is the county name? | SELECT "County" FROM table_25212 WHERE "District name" = 'Charyl Stockwell Academy' |
CREATE TABLE table_22754310_1 (
margin INTEGER,
party VARCHAR,
winner VARCHAR
) | Name the most margin for nco party and p. ramachandran won | SELECT MAX(margin) FROM table_22754310_1 WHERE party = "NCO" AND winner = "P. Ramachandran" |
CREATE TABLE table_42057 (
"Week" real,
"Date" text,
"TV Time" text,
"Opponent" text,
"Result" text
) | Which Week has a Result of l 13-16 and an Opponent of at buffalo bills? | SELECT AVG("Week") FROM table_42057 WHERE "Result" = 'l 13-16' AND "Opponent" = 'at buffalo bills' |
CREATE TABLE table_name_84 (
loses INTEGER,
position VARCHAR,
points VARCHAR,
goals_scored VARCHAR
) | How many loses have points greater than 30, goals scored greater than 59, with a position greater than 5? | SELECT SUM(loses) FROM table_name_84 WHERE points > 30 AND goals_scored > 59 AND position > 5 |
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 semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE... | Is there an CLIMATE 400 -level course that contains 4 credits ? | SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE program_course.catego... |
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25),
COUNTRY_ID varchar(2)
)
CREATE T... | For all employees who have the letters D or S in their first name, draw a line chart about the change of employee_id over hire_date , and list in desc by the x axis please. | SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE DESC |
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 average age of patients whose marital status is single and year of birth is greater than 2175? | SELECT AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.dob_year > "2175" |
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
) | For those records from the products and each product's manufacturer, find name and the average of code , and group by attribute name, and visualize them by a bar chart, rank by the Y-axis in asc. | SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Code |
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... | give me the number of patients whose ethnicity is american indian/alaska native and item id is 50803? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND lab.itemid = "50803" |
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto 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 icustays (
row_id number,
s... | first time patient 26156 got surgery until 2104? | SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26156) AND STRFTIME('%y', procedures_icd.charttime) <= '2104' ORDER BY procedures_icd.charttime LIMIT 1 |
CREATE TABLE table_71503 (
"Member countries" text,
"Population" text,
"Area (km\u00b2)" text,
"GDP (billion US$)" text,
"GDP per capita (US$)" text
) | What is the GDP of the nation with 56,210,000 people? | SELECT "GDP per capita (US$)" FROM table_71503 WHERE "Population" = '56,210,000' |
CREATE TABLE table_name_52 (
district VARCHAR,
incumbent VARCHAR
) | What district has benjamin eggleston for incumbent? | SELECT district FROM table_name_52 WHERE incumbent = "benjamin eggleston" |
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 less than 85 years old who have coronary artery disease or coronary artery bypass graft with mvr or maze primary disease? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE\CORONARY ARTERY BYPASS GRAFT WITH MVR; ? MAZE" AND demographic.age < "85" |
CREATE TABLE table_30110 (
"Player" text,
"Matches" real,
"Overs" text,
"Wickets" real,
"Average" text,
"Economy" text,
"BBI" text,
"4wi" real
) | What is the fewest number of wickets recorded? | SELECT MIN("Wickets") FROM table_30110 |
CREATE TABLE table_name_33 (
overall INTEGER,
slalom VARCHAR,
season VARCHAR
) | What is the highest overall prior to 1996 with a slalom of 39? | SELECT MAX(overall) FROM table_name_33 WHERE slalom = "39" AND season < 1996 |
CREATE TABLE table_name_7 (
position VARCHAR,
pick VARCHAR
) | Tell me the position for pick of 146 | SELECT position FROM table_name_7 WHERE pick = "146" |
CREATE TABLE minor_in (
stuid number,
dno number
)
CREATE TABLE enrolled_in (
stuid number,
cid text,
grade text
)
CREATE TABLE member_of (
facid number,
dno number,
appt_type text
)
CREATE TABLE course (
cid text,
cname text,
credits number,
instructor number,
day... | What are the rooms for members of the faculty who are professors and who live in building NEB? | SELECT room FROM faculty WHERE rank = "Professor" AND building = "NEB" |
CREATE TABLE Has_Allergy (
StuID INTEGER,
Allergy VARCHAR(20)
)
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
CREATE TABLE Allergy_Type (
Allergy VARCHAR(20),
... | A bar chart about the number of first name for all female students whose sex is F, list by the x-axis in descending. | SELECT Fname, COUNT(Fname) FROM Student WHERE Sex = 'F' GROUP BY Fname ORDER BY Fname DESC |
CREATE TABLE table_204_969 (
id number,
"composer" text,
"title" text,
"genre" text,
"date" number,
"notes" text
) | which composer is listed below pete doherty ? | SELECT "composer" FROM table_204_969 WHERE id = (SELECT id FROM table_204_969 WHERE "composer" = 'pete doherty') + 1 |
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 procedures (
... | give me the number of patients whose marital status is single and diagnoses long title is syncope and collapse? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "SINGLE" AND diagnoses.long_title = "Syncope and collapse" |
CREATE TABLE table_47375 (
"Place" text,
"Player" text,
"Country" text,
"Score" real,
"To par" text
) | When Payne Stewart of the United States scored higher than 69, what was the To Par? | SELECT "To par" FROM table_47375 WHERE "Country" = 'united states' AND "Score" > '69' AND "Player" = 'payne stewart' |
CREATE TABLE COURSE (
CRS_CODE varchar(10),
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8)
)
CREATE TABLE CLASS (
CLASS_CODE varchar(5),
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int
)
CREATE... | What is the first name and GPA of every student that has a GPA lower than average. | SELECT STU_FNAME, SUM(STU_GPA) FROM STUDENT WHERE STU_GPA < (SELECT AVG(STU_GPA) FROM STUDENT) GROUP BY STU_FNAME |
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 (
... | what is the number of patients whose year of death is less than or equal to 2126 and procedure long title is (aorto)coronary bypass of two coronary arteries? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2126.0" AND procedures.long_title = "(Aorto)coronary bypass of two coronary arteries" |
CREATE TABLE table_204_915 (
id number,
"draw" number,
"artist" text,
"song" text,
"points" number,
"place" text
) | bernadette 's soms and which other song earned the same number of points ? | SELECT "song" FROM table_204_915 WHERE "song" <> '"soms"' AND "points" = (SELECT "points" FROM table_204_915 WHERE "song" = '"soms"') |
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 fare_basis (
fare_basis_code text,
booking_class text,
class_type text,... | what is the ground transportation available in the city of PHILADELPHIA | SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'PHILADELPHIA' AND ground_service.city_code = city.city_code |
CREATE TABLE table_name_42 (
year INTEGER,
author VARCHAR
) | what is the earliest year when the author is reki kawahara? | SELECT MIN(year) FROM table_name_42 WHERE author = "reki kawahara" |
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 (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
... | give me the number of patients whose diagnoses long title is other preterm infants, 2,000-2,499 grams? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Other preterm infants, 2,000-2,499 grams" |
CREATE TABLE table_204_876 (
id number,
"ecclesiastical jurisdictions" text,
"latin name" text,
"type" text,
"rite" text,
"ecclesiastical province" text,
"established" text,
"area (km2)" number
) | how many roman catholic dioceses were established in angola before 1990 ? | SELECT COUNT("ecclesiastical jurisdictions") FROM table_204_876 WHERE "established" < 1990 |
CREATE TABLE table_204_750 (
id number,
"team" text,
"stadium" text,
"capacity" number,
"seated" number
) | which of the teams had the top number of capacity ? | SELECT "team" FROM table_204_750 ORDER BY "capacity" DESC LIMIT 1 |
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 the number of patients whose age is less than 62 and diagnoses long title is acute glomerulonephritis with other specified pathological lesion in kidney? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "62" AND diagnoses.long_title = "Acute glomerulonephritis with other specified pathological lesion in kidney" |
CREATE TABLE train (
train_id number,
name text,
time text,
service text
)
CREATE TABLE train_station (
train_id number,
station_id number
)
CREATE TABLE station (
station_id number,
name text,
annual_entry_exit number,
annual_interchanges number,
total_passengers number,
... | Show all train names and times in stations in London in descending order by train time. | SELECT T3.name, T3.time FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T2.location = 'London' ORDER BY T3.time DESC |
CREATE TABLE table_name_17 (
style VARCHAR,
choreographer_s_ VARCHAR
) | What is Style, when Choreographer(s) is Dave Scott? | SELECT style FROM table_name_17 WHERE choreographer_s_ = "dave scott" |
CREATE TABLE table_18141 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Results" text,
"Candidates" text
) | Who's the incumbent in Florida 6? | SELECT "Incumbent" FROM table_18141 WHERE "District" = 'Florida 6' |
CREATE TABLE equipment_sequence (
aircraft_code_sequence varchar,
aircraft_code 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,
... | give me the flights from MIAMI to NEW YORK using FF | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'NEW YORK' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MIAM... |
CREATE TABLE table_27114708_2 (
date_of_appointment VARCHAR,
team VARCHAR
) | For team ascoli please mention all the appointment date. | SELECT date_of_appointment FROM table_27114708_2 WHERE team = "Ascoli" |
CREATE TABLE table_17715 (
"Name of System" text,
"Location" text,
"Traction Type" text,
"Date (From)" text,
"Date (To)" text,
"Notes" text
) | how many notes are form the date (from) 14 march 1910? | SELECT COUNT("Notes") FROM table_17715 WHERE "Date (From)" = '14 March 1910' |
CREATE TABLE table_1987 (
"Match no." real,
"Match Type" text,
"Team Europe" text,
"Score" text,
"Team USA" text,
"Progressive Total" text
) | How many match numbers have team europe listed as osku palermaa? | SELECT COUNT("Match no.") FROM table_1987 WHERE "Team Europe" = 'Osku Palermaa' |
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
OwnerUserId number,
Comment text,
Text te... | How many users with rep less than 15. | SELECT COUNT(*) AS Users FROM Users WHERE Reputation < 15 AND Id > 0 |
CREATE TABLE table_46856 (
"Sport" text,
"League" text,
"Club" text,
"Founded" real,
"Venue" text,
"League championships" real,
"Championship years" text
) | Which League championship is the lowest one that has a Venue of penn state ice pavilion, and a Club of penn state nittany lions men's ice hockey? | SELECT MIN("League championships") FROM table_46856 WHERE "Venue" = 'penn state ice pavilion' AND "Club" = 'penn state nittany lions men''s ice hockey' |
CREATE TABLE table_test_4 (
"id" int,
"ejection_fraction_ef" int,
"systolic_blood_pressure_sbp" int,
"active_infection" bool,
"heart_disease" bool,
"renal_disease" bool,
"estimated_glomerular_filtration_rate_egfr" int,
"cardiogenic_shock" bool,
"diastolic_blood_pressure_dbp" int,
... | estimated glomerular filtration rate ( egfr ) < 30 ml / min / 1.73 m2 using the mdrd formula at visit 1. | SELECT * FROM table_test_4 WHERE estimated_glomerular_filtration_rate_egfr < 30 |
CREATE TABLE table_name_74 (
years_in_orlando VARCHAR,
school_club_team VARCHAR
) | Which Years in Orlando has a School/Club Team of texas tech? | SELECT years_in_orlando FROM table_name_74 WHERE school_club_team = "texas tech" |
CREATE TABLE table_68047 (
"Rank" real,
"Population" real,
"Name" text,
"Former Name" text,
"Municipality" text
) | Name the total number of ranks for kujalleq with former name of brattahl and population less than 47 | SELECT COUNT("Rank") FROM table_68047 WHERE "Municipality" = 'kujalleq' AND "Former Name" = 'brattahlíð' AND "Population" < '47' |
CREATE TABLE book_club (
category VARCHAR,
YEAR INTEGER
) | List categories that have at least two books after year 1989. | SELECT category FROM book_club WHERE YEAR > 1989 GROUP BY category HAVING COUNT(*) >= 2 |
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction 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,
test... | By whom is BIOLOGY 281 taught ? | SELECT DISTINCT instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'BIOLOGY' AND course.number = 281 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offerin... |
CREATE TABLE table_2896329_1 (
date VARCHAR,
handicap VARCHAR
) | On what date was the handicap 8 st 12 lb? | SELECT date FROM table_2896329_1 WHERE handicap = "8 st 12 lb" |
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 (
... | count the number of patients whose diagnoses short title is alcohol cirrhosis liver and lab test category is hematology? | 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 = "Alcohol cirrhosis liver" AND lab."CATEGORY" = "Hematology" |
CREATE TABLE table_name_8 (
pick__number INTEGER,
overall VARCHAR
) | What Average Pick # has an Overall of 296? | SELECT AVG(pick__number) FROM table_name_8 WHERE overall = 296 |
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 whose ethnicity is black/cape verdean and year of birth is less than 2078? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND demographic.dob_year < "2078" |
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 is the number of patients whose procedure long title is open reduction of fracture with internal fixation, femur and lab test category is blood gas? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Open reduction of fracture with internal fixation, femur" AND lab."CATEGORY" = "Blood Gas" |
CREATE TABLE table_204_651 (
id number,
"date" text,
"championship" text,
"location" text,
"category" text,
"surface" text,
"prev. result" text,
"prev. points" number,
"new points" number,
"outcome" text
) | what is the total of new points that have been given ? | SELECT SUM("new points") FROM table_204_651 |
CREATE TABLE table_9992 (
"Round" real,
"Pick" real,
"Player" text,
"Nationality" text,
"College" text
) | What is Player, when Round is less than 6, and when Pick is '69'? | SELECT "Player" FROM table_9992 WHERE "Round" < '6' AND "Pick" = '69' |
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,
... | what was the name of the drug patient 32755 got prescription for within 2 days after being diagnosed with bmi 33.0-33.9,adult in the last hospital visit? | SELECT t2.drug FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 32755 AND diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'bmi 33... |
CREATE TABLE table_name_54 (
director_s_ VARCHAR,
recipient VARCHAR
) | Who was the director that had a recipient of Redbag Pictures Ltd? | SELECT director_s_ FROM table_name_54 WHERE recipient = "redbag pictures ltd" |
CREATE TABLE table_39013 (
"Game" real,
"February" real,
"Opponent" text,
"Score" text,
"Record" text,
"Points" real
) | Which Record has a Points smaller than 62 and a February larger than 16, and a Score of 8 7? | SELECT "Record" FROM table_39013 WHERE "Points" < '62' AND "February" > '16' AND "Score" = '8–7' |
CREATE TABLE exhibition (
exhibition_id number,
year number,
theme text,
artist_id number,
ticket_price number
)
CREATE TABLE artist (
artist_id number,
name text,
country text,
year_join number,
age number
)
CREATE TABLE exhibition_record (
exhibition_id number,
date t... | How many artists do we have? | SELECT COUNT(*) FROM artist |
CREATE TABLE table_66216 (
"Rank" real,
"Athlete" text,
"Country" text,
"Day 1" real,
"Total" text
) | Who had a rank under 17 with a total of 119? | SELECT "Athlete" FROM table_66216 WHERE "Rank" < '17' AND "Total" = '119' |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,... | Provide the number of patients born before 2123 who have s/p hanging as their primary disease. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "S/P HANGING" AND demographic.dob_year < "2123" |
CREATE TABLE table_29020 (
"Pick #" real,
"Player" text,
"Position" text,
"Nationality" text,
"NHL team" text,
"College/junior/club team" text
) | What number pick was the player from HIFK Helsinki (Finland)? | SELECT "Pick #" FROM table_29020 WHERE "College/junior/club team" = 'HIFK Helsinki (Finland)' |
CREATE TABLE table_name_24 (
year INTEGER,
notes VARCHAR
) | What is the lowest Year, when Notes is '5.19km, 18controls'? | SELECT MIN(year) FROM table_name_24 WHERE notes = "5.19km, 18controls" |
CREATE TABLE table_name_50 (
diameter__km_ INTEGER,
latitude VARCHAR,
year_named VARCHAR,
longitude VARCHAR
) | What is the diameter for 1997 when longitude is 212.0e and latitude is 47.0n? | SELECT MIN(diameter__km_) FROM table_name_50 WHERE year_named = 1997 AND longitude = "212.0e" AND latitude = "47.0n" |
CREATE TABLE table_2453 (
"N\u00ba" real,
"Cabinet (Nickname)" text,
"Took office" text,
"Left office" text,
"Duration" text,
"Coalition parties" text,
"ministers" text,
"ministries" real,
"King" text
) | What is the most amount of ministries? | SELECT MAX("ministries") FROM table_2453 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.