table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE table_name_17 (
engine VARCHAR,
driver VARCHAR,
tyre VARCHAR,
constructor VARCHAR
) | what is the engine when the tyre is d, the constructor is era and the driver is bob gerard? | SELECT engine FROM table_name_17 WHERE tyre = "d" AND constructor = "era" AND driver = "bob gerard" |
CREATE TABLE table_32809 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What was the smallest crowd size at a home game for Footscray? | SELECT MIN("Crowd") FROM table_32809 WHERE "Home team" = 'footscray' |
CREATE TABLE music_festival (
id number,
music_festival text,
date_of_ceremony text,
category text,
volume number,
result text
)
CREATE TABLE artist (
artist_id number,
artist text,
age number,
famous_title text,
famous_release_date text
)
CREATE TABLE volume (
volume_i... | What is the average weeks on top of volumes associated with the artist aged 25 or younger? | SELECT AVG(T2.weeks_on_top) FROM artist AS T1 JOIN volume AS T2 ON T1.artist_id = T2.artist_id WHERE T1.age <= 25 |
CREATE TABLE table_31145 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" real
) | How many episodes were written by Gregg Mettler? | SELECT COUNT("No. in series") FROM table_31145 WHERE "Written by" = 'Gregg Mettler' |
CREATE TABLE table_28132 (
"Episode" real,
"Air Date" text,
"Team Swash" text,
"Team guest captain" text,
"Team Coxy" text
) | Who was the team guest captain for episode 2? | SELECT "Team guest captain" FROM table_28132 WHERE "Episode" = '2' |
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,
... | what is the number of patients whose religion is protestant quaker and lab test name is thyroid stimulating hormone? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "PROTESTANT QUAKER" AND lab.label = "Thyroid Stimulating Hormone" |
CREATE TABLE captain (
Captain_ID int,
Name text,
Ship_ID int,
age text,
Class text,
Rank text
)
CREATE TABLE Ship (
Ship_ID int,
Name text,
Type text,
Built_Year real,
Class text,
Flag text
) | For those ships that do not have a captain, tell me the total number of their classes using a pie chart, display from low to high by the bars please. | SELECT Class, COUNT(Class) FROM Ship WHERE NOT Ship_ID IN (SELECT Ship_ID FROM captain) GROUP BY Class ORDER BY Class |
CREATE TABLE table_name_41 (
song VARCHAR,
draw INTEGER
) | What song has draw number less than 2? | SELECT song FROM table_name_41 WHERE draw < 2 |
CREATE TABLE table_15049 (
"Film" text,
"Director(s)" text,
"Producer(s)" text,
"Writer(s)" text,
"Recipient" text,
"Date" text,
"Award" text
) | Who was the producer for the film 'Strange Little Girls'? | SELECT "Producer(s)" FROM table_15049 WHERE "Film" = 'strange little girls' |
CREATE TABLE table_name_55 (
visitor VARCHAR,
home VARCHAR,
date VARCHAR
) | Name the visitor for detroit on february 24 | SELECT visitor FROM table_name_55 WHERE home = "detroit" AND date = "february 24" |
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 average age of patients whose discharge location is disch-tran to psych hosp and primary disease is left femur fracture? | SELECT AVG(demographic.age) FROM demographic WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND demographic.diagnosis = "LEFT FEMUR FRACTURE" |
CREATE TABLE table_20674 (
"State" text,
"Preliminary Average" text,
"Interview" text,
"Swimsuit" text,
"Evening Gown" text,
"Semifinal Average" text
) | What was the preliminary average for the one who had a semifinal average of 8.966 (3)? | SELECT "Preliminary Average" FROM table_20674 WHERE "Semifinal Average" = '8.966 (3)' |
CREATE TABLE Customers (
customer_id INTEGER,
customer_first_name VARCHAR(20),
customer_last_name VARCHAR(20),
customer_address VARCHAR(255),
customer_phone VARCHAR(255),
customer_email VARCHAR(255),
other_customer_details VARCHAR(255)
)
CREATE TABLE Financial_Transactions (
transaction... | What are the different card types, and how many transactions have been made with each. Visualize by bar chart. | SELECT card_type_code, COUNT(*) FROM Financial_Transactions AS T1 JOIN Customers_Cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code |
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 whose insurance is private and procedure short title is ventricl shunt tube punc? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.short_title = "Ventricl shunt tube punc" |
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 demographic ... | what is the number of patients whose diagnoses long title is incisional ventral hernia with obstruction? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Incisional ventral hernia with obstruction" |
CREATE TABLE artist (
Artist_ID int,
Name text,
Country text,
Year_Join int,
Age int
)
CREATE TABLE exhibition_record (
Exhibition_ID int,
Date text,
Attendance int
)
CREATE TABLE exhibition (
Exhibition_ID int,
Year int,
Theme text,
Artist_ID int,
Ticket_Price real... | What are the names and ages of artists? Show the result in a bar graph, list y axis in descending order. | SELECT Name, Age FROM artist ORDER BY Age DESC |
CREATE TABLE table_70165 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text,
"Money ( $ )" text
) | Name the player for 68-68-75-74=285 | SELECT "Player" FROM table_70165 WHERE "Score" = '68-68-75-74=285' |
CREATE TABLE table_19704392_1 (
modified_speed__6th_gear_ INTEGER,
standard_speed__6th_gear_ VARCHAR
) | when the max speed for modified speed (6th gear) where standard speed (6th gear) is 98 | SELECT MAX(modified_speed__6th_gear_) FROM table_19704392_1 WHERE standard_speed__6th_gear_ = "98" |
CREATE TABLE table_2144389_9 (
episodes_used VARCHAR,
_number VARCHAR
) | When 1 is the number what episodes were used? | SELECT episodes_used FROM table_2144389_9 WHERE _number = 1 |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob... | what are the four most commonly given lab tests last year for patients who were previously diagnosed with hx of kidney malignancy in the same hospital visit? | SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id W... |
CREATE TABLE table_name_64 (
rider VARCHAR,
bike VARCHAR,
time VARCHAR,
laps VARCHAR,
grid VARCHAR
) | Who was the rider riding the Kawasaki ZX-6r, that rode less than 22 laps, and the grid was greater than 19, and retirement was the time? | SELECT rider FROM table_name_64 WHERE laps < 22 AND grid > 19 AND time = "retirement" AND bike = "kawasaki zx-6r" |
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE intakeoutput (
in... | piperacillin-tazobactam 3.375 g ivpb what is the price? | SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'piperacillin-tazobactam 3.375 g ivpb') |
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,... | what is admission time and diagnoses long title of subject id 813? | SELECT demographic.admittime, diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "813" |
CREATE TABLE table_25882 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Series" text
) | Where was game number 5 played? | SELECT "Location Attendance" FROM table_25882 WHERE "Game" = '5' |
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE... | Starting point for 'real world questions are on-topic' comments. | SELECT DISTINCT CONCAT('https://worldbuilding.stackexchange.com/questions/', Posts.ParentId, '/', CommentsAboutOntopic.PostId, '#comment', CommentsAboutOntopic.Id, '_', CommentsAboutOntopic.PostId) AS Link, CommentsAboutOntopic.Text, CommentsAboutOntopic.CreationDate FROM (SELECT * FROM Comments WHERE LOWER(Text) LIKE ... |
CREATE TABLE table_24111 (
"Game" real,
"Date" text,
"Opponent" text,
"Result" text,
"Black Knights points" real,
"Opponents" real,
"Record" text
) | Name the number of date for 1-0 record | SELECT COUNT("Date") FROM table_24111 WHERE "Record" = '1-0' |
CREATE TABLE class_of_service (
booking_class varchar,
rank int,
class_description text
)
CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minutes_distant int
)... | do you have a flight leaving BOSTON at 645 going to WASHINGTON | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON' AND flight.departure_time = 645 AND flight.to_airport = AIRPORT_SERVICE_1.air... |
CREATE TABLE table_19425 (
"State/UT Code" real,
"India/State/UT" text,
"Literate Persons (%)" text,
"Males (%)" text,
"Females (%)" text
) | What is the percentage of females where the state code is a 4? | SELECT "Females (%)" FROM table_19425 WHERE "State/UT Code" = '4' |
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
CREATE TAB... | Answers by Time of Day. Designed to consider whether 'night' questions have more visibility than 'day' questions | SELECT TIME_TO_STR(Posts.CreationDate, '%h') AS Hour, COUNT(Posts.Id) AS Questions FROM Posts WHERE PostTypeId = 2 GROUP BY TIME_TO_STR(Posts.CreationDate, '%h') ORDER BY TIME_TO_STR(Posts.CreationDate, '%h') |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostNotices (
Id num... | Answers to old unanswered questions. | SELECT A.Id AS "post_link", A.Score, (CASE WHEN Q.AcceptedAnswerId = A.Id THEN 1 ELSE 0 END) AS Accepted, A.OwnerUserId AS "user_link" FROM Posts AS A INNER JOIN Posts AS Q ON A.ParentId = Q.Id WHERE A.CreationDate BETWEEN @StartTime AND @EndTime AND Q.PostTypeId = 1 AND Q.ClosedDate IS NULL AND Q.CreationDate < @AskTi... |
CREATE TABLE table_41124 (
"Rank" real,
"Municipality" text,
"Population (2010 Census)" real,
"Population (2005 Census)" real,
"Population (2000 Census)" real
) | What is the lowest population (2000 Census) that has a population (2010 Census) larger than 1,071,913 and municipality of Suwon? | SELECT MIN("Population (2000 Census)") FROM table_41124 WHERE "Municipality" = 'suwon' AND "Population (2010 Census)" > '1,071,913' |
CREATE TABLE table_name_36 (
census_ranking VARCHAR,
population VARCHAR,
area_km_2 VARCHAR
) | Which Census Ranking has a Population smaller than 879, and an Area km 2 larger than 537.62? | SELECT census_ranking FROM table_name_36 WHERE population < 879 AND area_km_2 > 537.62 |
CREATE TABLE table_69657 (
"Player" text,
"Score" text,
"Balls" real,
"Opponent" text,
"Ground" text
) | Who played on waca ground and scored 79 points? | SELECT "Opponent" FROM table_69657 WHERE "Ground" = 'waca ground' AND "Score" = '79' |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob... | what is the number of patients having delayed clos abd wound in 2103? | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'delayed clos abd wound') AND STRFTIME('%y', procedur... |
CREATE TABLE customer (
state VARCHAR,
acc_type VARCHAR,
credit_score VARCHAR,
no_of_loans VARCHAR
) | Find the state, account type, and credit score of the customer whose number of loan is 0. | SELECT state, acc_type, credit_score FROM customer WHERE no_of_loans = 0 |
CREATE TABLE table_name_51 (
finish VARCHAR,
country VARCHAR,
player VARCHAR
) | what is the finish when the country is united states and the player is tiger woods? | SELECT finish FROM table_name_51 WHERE country = "united states" AND player = "tiger woods" |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
d... | patient 26469 underwent any lt heart angiocardiogram procedure? | SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'lt heart angiocardiogram') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26469) |
CREATE TABLE table_17053 (
"Player" text,
"Position" text,
"School" text,
"Hometown" text,
"MLB Draft" text
) | What is the hometown of the pitcher who's school was Saint Joseph Regional High School? | SELECT "Hometown" FROM table_17053 WHERE "Position" = 'Pitcher' AND "School" = 'Saint Joseph Regional High School' |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | how many patients are with medicaid insurance and diagnosed with retained plastic fragments? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicaid" AND diagnoses.long_title = "Retained plastic fragments" |
CREATE TABLE table_2856 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | Who led with the highest points during the game against Indiana? | SELECT "High points" FROM table_2856 WHERE "Team" = 'Indiana' |
CREATE TABLE table_39493 (
"Round" real,
"Pick #" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
) | Which Pick # is the lowest one that has a College of troy state, and a Name of reggie dwight, and an Overall smaller than 217? | SELECT MIN("Pick #") FROM table_39493 WHERE "College" = 'troy state' AND "Name" = 'reggie dwight' AND "Overall" < '217' |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,... | give me the number of patients whose diagnoses long title is diabetes with ketoacidosis, type i [juvenile type], not stated as uncontrolled and lab test abnormal status is abnormal? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Diabetes with ketoacidosis, type I [juvenile type], not stated as uncontrolled" AND lab.flag = "abnormal" |
CREATE TABLE table_13619053_8 (
high_points VARCHAR,
game VARCHAR
) | How many players led Game #66 in scoring? | SELECT COUNT(high_points) FROM table_13619053_8 WHERE game = 66 |
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,
... | what is gender of subject id 17787? | SELECT demographic.gender FROM demographic WHERE demographic.subject_id = "17787" |
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
zip int
)
CREATE TABLE course_tags_count (
course_id int,
clear_grading int,
pop_quiz int,
group_projects int,
inspirational int... | 451 is taught by professors other than Prof. Mark Oyen ? | SELECT DISTINCT instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 451 AND NOT instructor.name LIKE '%Mark Oyen%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering... |
CREATE TABLE teachers (
lastname text,
firstname text,
classroom number
)
CREATE TABLE list (
lastname text,
firstname text,
grade number,
classroom number
) | Report the number of students in each classroom. | SELECT classroom, COUNT(*) FROM list GROUP BY classroom |
CREATE TABLE table_203_651 (
id number,
"year" number,
"competition" text,
"venue" text,
"position" text,
"notes" text
) | how many times after the year 1989 did she come in 1st position ? | SELECT COUNT(*) FROM table_203_651 WHERE "position" = 1 AND "year" > 1989 |
CREATE TABLE table_13568 (
"Year" real,
"Stage" real,
"Start of stage" text,
"Distance (km)" text,
"Category of climb" text,
"Stage winner" text,
"Yellow jersey" text
) | who was the Stage winner when the stage was smaller than 16, earlier than 1986, and a distance (km) was 19.6? | SELECT "Stage winner" FROM table_13568 WHERE "Stage" < '16' AND "Year" < '1986' AND "Distance (km)" = '19.6' |
CREATE TABLE table_37810 (
"Tournament" text,
"2006" text,
"2008" text,
"2009" text,
"2010" text,
"2011" text,
"2012" text,
"2013" text
) | Name the 2012 with 2013 of 2r and 2009 of 3r | SELECT "2012" FROM table_37810 WHERE "2013" = '2r' AND "2009" = '3r' |
CREATE TABLE table_25068 (
"District" text,
"Vacator" text,
"Reason for change" text,
"Successor" text,
"Date successor seated" text
) | The successor for the Massachusetts 20th district was seated on what date? | SELECT "Date successor seated" FROM table_25068 WHERE "District" = 'Massachusetts 20th' |
CREATE TABLE table_47826 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" real
) | What is the highest To Par, when Score is '72-73=145'? | SELECT MAX("To par") FROM table_47826 WHERE "Score" = '72-73=145' |
CREATE TABLE table_26967 (
"Season" real,
"Regular Season" text,
"Playoffs" text,
"U.S. Open Cup" text,
"CONCACAF" text,
"Final Record" text
) | how many time is the final record is 9 16 5? | SELECT COUNT("Season") FROM table_26967 WHERE "Final Record" = '9–16–5' |
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 code_description (
code varchar,
description text
)
CREATE TABLE month (
... | show me the flights to DAL from all other airports | SELECT DISTINCT flight.flight_id FROM airport, airport_service, city, flight WHERE airport.airport_code = 'DAL' AND city.city_code = airport_service.city_code AND flight.from_airport = airport_service.airport_code AND flight.to_airport = airport.airport_code |
CREATE TABLE Projects (
Code Char(4),
Name Char(50),
Hours int
)
CREATE TABLE Scientists (
SSN int,
Name Char(30)
)
CREATE TABLE AssignedTo (
Scientist int,
Project char(4)
) | Find the name of the project for which a scientist whose name contains Smith is assigned to, and count them by a bar chart, could you order by the x-axis in descending? | SELECT T2.Name, COUNT(T2.Name) FROM AssignedTo AS T1 JOIN Projects AS T2 ON T1.Project = T2.Code JOIN Scientists AS T3 ON T1.Scientist = T3.SSN WHERE T3.Name LIKE '%Smith%' GROUP BY T2.Name ORDER BY T2.Name DESC |
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREATE TABLE flight_fare (
flight_id int,
fare_id int
)
CREATE TABLE flight (
aircraft_code_sequence text,
airline_code varchar,
airline_flight text,
arrival_time int,
connections int,
departure_time... | please list the ground transportation from LGA into NEW YORK | SELECT DISTINCT transport_type FROM ground_service WHERE (airport_code IN (SELECT AIRPORTalias0.airport_code FROM airport AS AIRPORTalias0 WHERE AIRPORTalias0.airport_code = 'LGA') AND city_code IN (SELECT CITYalias0.city_code FROM city AS CITYalias0 WHERE CITYalias0.city_name = 'NEW YORK')) |
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 demographic ... | what is the number of patients whose hospital stay is above 0 days and underwent procedure intravenous infusion of clofarabine? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "0" AND procedures.long_title = "Intravenous infusion of clofarabine" |
CREATE TABLE table_name_13 (
total INTEGER,
floor_exercise VARCHAR,
rank VARCHAR
) | What's the lowest total when the floor exercise is less than 36.724 and the rank is lower than 8? | SELECT MIN(total) FROM table_name_13 WHERE floor_exercise < 36.724 AND rank < 8 |
CREATE TABLE table_203_536 (
id number,
"#" number,
"date" text,
"opponent" text,
"score" text,
"win" text,
"loss" text,
"save" text,
"crowd" number,
"record" text
) | what is the total amount of times they played against opponent @min ? | SELECT COUNT(*) FROM table_203_536 WHERE "opponent" = '@min' |
CREATE TABLE table_36902 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" text,
"Record" text
) | Attendance of 23,150 had what opponent? | SELECT "Opponent" FROM table_36902 WHERE "Attendance" = '23,150' |
CREATE TABLE table_3517 (
"Episode #" text,
"Season Episode #" text,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Prod. code" text
) | What is the number of production codes for episode #73? | SELECT COUNT("Prod. code") FROM table_3517 WHERE "Episode #" = '73' |
CREATE TABLE table_34866 (
"Year" text,
"Title" text,
"Role" text,
"Producer" text,
"Director" text
) | Which Director has a Role of melissa? | SELECT "Director" FROM table_34866 WHERE "Role" = 'melissa' |
CREATE TABLE table_13836704_9 (
airport VARCHAR,
rank VARCHAR
) | how many airport with rank being 4 | SELECT COUNT(airport) FROM table_13836704_9 WHERE rank = 4 |
CREATE TABLE table_51891 (
"Pick" real,
"Round" text,
"Player" text,
"Position" text,
"School" text
) | When was terry cook picked? | SELECT AVG("Pick") FROM table_51891 WHERE "Player" = 'terry cook' |
CREATE TABLE table_18662026_10 (
parallel_bars VARCHAR,
floor VARCHAR
) | If the floor number is 14.200, what is the number for the parallel bars? | SELECT parallel_bars FROM table_18662026_10 WHERE floor = "14.200" |
CREATE TABLE table_52073 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What home team played against Richmond? | SELECT "Home team" FROM table_52073 WHERE "Away team" = 'richmond' |
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 prescriptions (
subject_id text,
hadm_id... | how many of the divorcee patients had icd9 code 8968? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "DIVORCED" AND procedures.icd9_code = "8968" |
CREATE TABLE table_name_22 (
score VARCHAR,
player VARCHAR
) | What is the score for Ky Laffoon? | SELECT score FROM table_name_22 WHERE player = "ky laffoon" |
CREATE TABLE captain (
Captain_ID int,
Name text,
Ship_ID int,
age text,
Class text,
Rank text
)
CREATE TABLE Ship (
Ship_ID int,
Name text,
Type text,
Built_Year real,
Class text,
Flag text
) | Return a bar chart on what are the different ship flags, and how many ships have each?, order in asc by the bar. | SELECT Flag, COUNT(*) FROM Ship GROUP BY Flag ORDER BY Flag |
CREATE TABLE table_name_17 (
laps INTEGER,
team VARCHAR
) | What are Perkins Engineering's fewest laps? | SELECT MIN(laps) FROM table_name_17 WHERE team = "perkins engineering" |
CREATE TABLE table_39024 (
"Country" text,
"Date" text,
"Label" text,
"Format" text,
"Catalogue #" text
) | What is the label for December 2004? | SELECT "Label" FROM table_39024 WHERE "Date" = 'december 2004' |
CREATE TABLE table_name_9 (
period VARCHAR,
player VARCHAR
) | In which period did Stanislav Chistov get a penalty? | SELECT period FROM table_name_9 WHERE player = "stanislav chistov" |
CREATE TABLE table_name_23 (
country VARCHAR,
place VARCHAR,
score VARCHAR
) | What is the home country of the player who placed t5 and had a score of 69-71=140? | SELECT country FROM table_name_23 WHERE place = "t5" AND score = 69 - 71 = 140 |
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,
... | specify the name of drug code lope2 | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.formulary_drug_cd = "LOPE2" |
CREATE TABLE table_13378 (
"Position" text,
"Name" text,
"Party" text,
"First Election" text,
"District" text
) | What is the Position of the person with a First Election of 1988 as Vice Mayor 2009? | SELECT "Position" FROM table_13378 WHERE "First Election" = '1988 as vice mayor 2009' |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREAT... | show me the difference between patient 006-1629's total input and output volume on 09/10/2105. | SELECT (SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-1629')) AND intakeoutput.cellpath LI... |
CREATE TABLE table_52538 (
"Competition" text,
"Played" real,
"Drawn" real,
"Lost" real,
"Position" text,
"Coach" text,
"Captain" text,
"Main Article" text
) | How many Drawn did Coach Francis Cummins have with less than 4 Lost? | SELECT SUM("Drawn") FROM table_52538 WHERE "Lost" < '4' AND "Coach" = 'francis cummins' |
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
) | how old is the youngest person for each job? | SELECT job, MIN(age) FROM Person GROUP BY job |
CREATE TABLE table_21194 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | For High Assists of Raymond Felton (12), who were the High rebounds? | SELECT "High rebounds" FROM table_21194 WHERE "High assists" = 'Raymond Felton (12)' |
CREATE TABLE table_204_713 (
id number,
"rank" number,
"bib" number,
"athlete" text,
"country" text,
"time" text,
"deficit" text
) | how many rankings are there ? | SELECT MAX("rank") FROM table_204_713 |
CREATE TABLE table_51172 (
"Season" text,
"Races" real,
"Podiums" real,
"Pole" real,
"FLaps" real
) | WHAT ARE THE RACES WITH A POLE SMALLER THAN 2 IN 2007? | SELECT MIN("Races") FROM table_51172 WHERE "Pole" < '2' AND "Season" = '2007' |
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,
... | calculate how many medicines were prescribed to patient 003-33922 until 2104. | SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '003-33922')) AND STRFTIME('%y', medication.drugstarttime) <= '2104' |
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... | Show me about the distribution of ACC_Road and the average of School_ID , and group by attribute ACC_Road in a bar chart, I want to display Y in desc order. | SELECT ACC_Road, AVG(School_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY AVG(School_ID) DESC |
CREATE TABLE school (
county VARCHAR,
enrollment INTEGER
) | Show each county along with the number of schools and total enrollment in each county. | SELECT county, COUNT(*), SUM(enrollment) FROM school GROUP BY county |
CREATE TABLE table_8154 (
"Nat." text,
"Name" text,
"Moving to" text,
"Type" text,
"Transfer window" text,
"Transfer fee" text
) | What is the transfer fee for Jimmy Gibson? | SELECT "Transfer fee" FROM table_8154 WHERE "Name" = 'jimmy gibson' |
CREATE TABLE table_75884 (
"Type" text,
"Name" text,
"Title" text,
"Royal house" text,
"From" text
) | When did Philoxenus Anicetus begin to hold power? | SELECT "From" FROM table_75884 WHERE "Name" = 'philoxenus anicetus' |
CREATE TABLE table_9247 (
"Official Name" text,
"Status" text,
"Area km 2" real,
"Population" real,
"Census Ranking" text
) | What is the area (in km2) for the town of lam que, with a population of less than 4,351? | SELECT AVG("Area km 2") FROM table_9247 WHERE "Status" = 'town' AND "Population" < '4,351' AND "Official Name" = 'lamèque' |
CREATE TABLE table_41806 (
"Country" text,
"1997" real,
"1998" real,
"1999" real,
"2000" real,
"2001" real,
"2002" real,
"2003" real,
"2004" real,
"2005" real,
"2006" real,
"2007" real,
"2008" real,
"2009" real,
"2010" real,
"2011" real,
"2012" real,
... | How much is the highest number in 2006 with fewer than 0 in 2002? | SELECT MAX("2006") FROM table_41806 WHERE "2002" < '0' |
CREATE TABLE table_name_94 (
team VARCHAR,
podiums VARCHAR,
position VARCHAR
) | Which Team has Podiums of 0, and a Position of nc ? | SELECT team FROM table_name_94 WHERE podiums = "0" AND position = "nc†" |
CREATE TABLE table_76967 (
"Date" text,
"Opponent" text,
"Score" text,
"Result" text,
"Record" text
) | WHAT IS THE SCORE WITH A RECORD OF 1-0? | SELECT "Score" FROM table_76967 WHERE "Record" = '1-0' |
CREATE TABLE country (
country_id number,
country text,
last_update time
)
CREATE TABLE category (
category_id number,
name text,
last_update time
)
CREATE TABLE language (
language_id number,
name text,
last_update time
)
CREATE TABLE address (
address_id number,
address ... | What is the full name of the staff member who has rented a film to a customer with the first name April and the last name Burns? | SELECT DISTINCT T1.first_name, T1.last_name FROM staff AS T1 JOIN rental AS T2 ON T1.staff_id = T2.staff_id JOIN customer AS T3 ON T2.customer_id = T3.customer_id WHERE T3.first_name = 'APRIL' AND T3.last_name = 'BURNS' |
CREATE TABLE table_name_90 (
outcome VARCHAR,
tournament VARCHAR
) | What is Outcome, when Tournament is 'Chiang Mai , Thailand'? | SELECT outcome FROM table_name_90 WHERE tournament = "chiang mai , thailand" |
CREATE TABLE table_13176 (
"Ranking" text,
"Nationality" text,
"Name" text,
"Years" text,
"Goals" real
) | What was the nationality for the player with 33 goals? | SELECT "Nationality" FROM table_13176 WHERE "Goals" = '33' |
CREATE TABLE table_43646 (
"Round" real,
"Pick" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
) | What is the number that is the lowest overall for the College of Baylor? | SELECT MIN("Overall") FROM table_43646 WHERE "College" = 'baylor' |
CREATE TABLE table_name_68 (
manufacturer VARCHAR,
type VARCHAR
) | Which manucfaturer's type was 2-6-0? | SELECT manufacturer FROM table_name_68 WHERE type = "2-6-0" |
CREATE TABLE table_35769 (
"Name" text,
"Goals" real,
"Apps" real,
"Avge" real,
"Career" text
) | What is the highest number of apps of the player with more than 63 goals and an avge of 0.45? | SELECT MAX("Apps") FROM table_35769 WHERE "Goals" > '63' AND "Avge" = '0.45' |
CREATE TABLE table_25042332_27 (
fixed_telephone_line VARCHAR,
vehicle VARCHAR
) | Name the fixed telephone line for 25.6% vehicle | SELECT fixed_telephone_line FROM table_25042332_27 WHERE vehicle = "25.6%" |
CREATE TABLE table_27982 (
"No. in series" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" text,
"U.S. viewers (million)" text
) | Who directed episode number 18 in the series? | SELECT "Directed by" FROM table_27982 WHERE "No. in series" = '18' |
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
U... | Fetching Title with relevant information. | SELECT Id, Title, Score, AnswerCount, FavoriteCount, ViewCount, CreationDate, ClosedDate FROM Posts |
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE PostHistory... | Number of downvotes and upvotes per month. | SELECT LAST_DATE_OF_MONTH(CreationDate), SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) AS downvotes, SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) AS upvotes, ROUND(1.0 * SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) / SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END), 3) AS ratio FROM Votes WHERE VoteTypeId IN (2,... |
CREATE TABLE table_name_76 (
total INTEGER,
rank VARCHAR,
bronze VARCHAR,
silver VARCHAR
) | What is the average total with less than 8 bronze, 3 silver, and a Rank smaller than 2? | SELECT AVG(total) FROM table_name_76 WHERE bronze < 8 AND silver = 3 AND rank < 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.