db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
movies_4
What is Walt Disney Pictures' most popular movie?
Walt Disney Pictures refers to company_name = 'Walt Disney Pictures'; most popular movie refers to max(popularity)
SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Walt Disney Pictures' ORDER BY T3.popularity DESC LIMIT 1
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
How many brands of bottle root beer were purchased between 4/3/2015 and 10/26/2015?
bottle root beer refers to ContainerType = 'Bottle'; purchased between 4/3/2015 and 10/26/2015 refers to PurchaseDate BETWEEN '2015-04-23' AND '2015-10-26';
SELECT COUNT(BrandID) FROM rootbeer WHERE ContainerType = 'Bottle' AND PurchaseDate BETWEEN '2015-04-03' AND '2015-10-26'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
retail_complains
Complaint about Credit Card mostly came from clients of which age group?
about Credit Card refers to Product = 'Credit Card'; teenager refers to 13 < age < = 19; adult refers to 19 < age < = 65; elder refers to age < = 65
SELECT SUM(CASE WHEN T1.age > 13 AND T1.age <= 19 THEN 1 ELSE 0 END), SUM(CASE WHEN T1.age > 19 AND T1.age <= 65 THEN 1 ELSE 0 END) AS adult , SUM(CASE WHEN T1.age > 65 THEN 1 ELSE 0 END) AS elder FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.Product = 'Credit card'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
movies_4
How many female crews are in the movie "Mr. Smith Goes to Washington"?
female crews refers to gender = 'Female'; "Mr. Smith Goes to Washington" refers to title = 'Mr. Smith Goes to Washington'
SELECT COUNT(T3.gender) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Mr. Smith Goes to Washington' AND T3.gender = 'Female'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
What brands of beers are manufactured at coordinates 38,566,129, -121,426,432?
coordinates 38,566,129, -121,426,432 refers to Latitude = 38.566129 AND Longitude = -121.426432;
SELECT DISTINCT T2.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID INNER JOIN geolocation AS T3 ON T1.LocationID = T3.LocationID WHERE T3.Latitude = '38.566129' AND T3.Longitude = '-121.426432'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
Who played Captain Jack Sparrow in all of the Pirates of the Caribbean movies?
Captain Jack Sparrow refers to character_name = 'Captain Jack Sparrow'; Pirates of the Caribbean movies refers to title LIKE 'Pirates of the Carribbean%'
SELECT DISTINCT T3.person_name FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T2.character_name = 'Captain Jack Sparrow' AND T1.title LIKE 'Pirates of the Caribbean%'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
List the brand IDs of the beers whose star rating is more than 3.
star rating is more than 3 refers to StarRating > 3;
SELECT BrandID FROM rootbeerreview WHERE StarRating > 3
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
What is the title of Jamie Foxx's most recent movie?
most recent movie refers to max(release_date)
SELECT T1.title FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Jamie Foxx' ORDER BY T1.release_date DESC LIMIT 1
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
Which production company produced the movie that made the most money at the box office?
Which production company refers to company_name; most money at the box office refers to max(revenue)
SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id GROUP BY T1.company_id ORDER BY SUM(T3.revenue) DESC LIMIT 1
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
How many movies did Harrison Ford appear in total?
null
SELECT COUNT(T2.movie_id) FROM person AS T1 INNER JOIN movie_cast AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Harrison Ford'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
How many female mailing list subscribers from Sacramento gave a 4-star rating between 1/3/2016 and 10/26/2016?
female refers to Gender = 'F'; mailing list subscribers refers to SubscribedToEmailList = 'TRUE'; Elk Grove refers to City = 'Sacramento'; 4-star rating refers to StarRating = 4; between 1/3/2016 and 10/26/2016 refers to ReviewDate BETWEEN '2016-01-03' AND '2016-10-26';
SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating = 4 AND T1.City = 'Sacramento' AND T1.Gender = 'F' AND T1.SubscribedToEmailList = 'TRUE' AND T2.ReviewDate BETWEEN '2013-01-03' AND '2013-10-26'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
retail_complains
Calculate the percentage of complaints made by Google account client in server ZOHARI.
Google account refers to email like '%@gmail.com'; percentage = divide(count(Complaint ID where email like '%@gmail.com') , count(Complaint ID)) * 100%
SELECT CAST(SUM(CASE WHEN T1.email LIKE '%@gmail.com' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.email) FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T2.server = 'ZOHARI'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
beer_factory
What percentage of customers who paid with a Discover Credit Card gave a 3-star rating?
percentage = MULTIPLY(DIVIDE(COUNT(CustomerID WHERE StarRating = 3), COUNT(CustomerID) WHERE CreditCardType = 'Discover'), 100); Discover Credit Card refers to CreditCardType = 'Discover'; 3-star rating refers to StarRating = 3;
SELECT CAST(COUNT(CASE WHEN T1.StarRating = 3 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.CustomerID) FROM rootbeerreview AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.CreditCardType = 'Discover'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
What is the title of the first crime movie ever released?
first crime movie ever released refers to min(release_date) and genre_name = 'Crime'
SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T3.genre_name = 'Crime' ORDER BY T1.release_date LIMIT 1
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
How many times did Anna Himes use her Mastercard when paying between 12/25/2014 and 5/20/2016 ?
Mastercard refers to CreditCardType = 'MasterCard'; between 12/25/2014 and 5/20/2016 refers to TransactionDate BETWEEN '2014-12-25' AND '2016-05-20';
SELECT COUNT(T2.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Anna' AND T1.Last = 'Himes' AND T2.CreditCardType = 'MasterCard' AND T2.TransactionDate BETWEEN '2014-12-25' AND '2016-05-20'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
List the names of the production companies that made at least 200 movies.
names of the production companies refers to company_name; at least 200 movies refers to COUNT(company_name) > = 200
SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id HAVING COUNT(T2.movie_id) > 200
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
List the person IDs of the second film editors in Movie No. 12.
second film editors refers to job = 'Second Film Editor'; Movie No. 12 refers to movie_id = 12
SELECT person_id FROM movie_crew WHERE movie_id = 12 AND job = 'Second Film Editor'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
Tally the email addresses and phone numbers of customers from Sacramento who gave a star rating of more than 3 in 2014.
email addresses refers to Email; Sacramento refers to City = 'Sacramento'; star rating of more than 3 refers to StarRating > 3; in 2014 refers to ReviewDate LIKE '2014%';
SELECT DISTINCT T1.Email, T1.PhoneNumber FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating > 3 AND T1.City = 'Sacramento' AND T2.ReviewDate BETWEEN '2014-01-01' AND '2014-12-31'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
How many movies released in 1995 did Quentin Tarantino appear in?
released in 1995 refers to release_date LIKE '1995%'
SELECT COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Quentin Tarantino' AND CAST(STRFTIME('%Y', T1.release_date) AS INT) = 1995
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
Write the person ID and character name of casts between order numbers 1 and 10 in Movie No. 285.
casts between order numbers 1 and 10 refers to cast_order BETWEEN 2 AND 9; Movie No. 285 refers to movie_id = 285
SELECT person_id, character_name FROM movie_cast WHERE movie_id = 285 AND cast_order BETWEEN 1 AND 10
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
How many horror movies are there?
horror movies refers to genre_name = 'Horror'
SELECT COUNT(T1.movie_id) FROM movie_genres AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.genre_id WHERE T2.genre_name = 'Horror'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
List the brand names of bottled root beer whose first brewing year is no later than 1930.
bottled root beer refers to ContainerType = 'Bottle'; first brewing year is no later than 1930 refers to FirstBrewedYear < 1930;
SELECT T2.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T2.FirstBrewedYear < '1930-01-01' AND T1.ContainerType = 'Bottle' ORDER BY T2.FirstBrewedYear LIMIT 1
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
In Movie No. 19, how many people are there in Department No. 7? Please give me their job.
Movie No. 19 refers to movie_id = 19; Department No. 7 refers to department_id = 7
SELECT COUNT(DISTINCT job) FROM movie_crew WHERE movie_id = 19 AND department_id = 7
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
Tally the movie ID and character name in the movie starring Jim Carrey.
null
SELECT T2.movie_id, T2.character_name FROM person AS T1 INNER JOIN movie_cast AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Jim Carrey'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
How many animators does Movie No. 129 have?
animators refers to job = 'Animation'; Movie No. 129 refers to movie_id = 129
SELECT COUNT(movie_id) FROM movie_crew WHERE movie_id = 129 AND job = 'Animation'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
What is the brand name of the root beer that gained a 1-star rating from customer ID 331115 while saying, "Yuk, more like licorice soda"?
1-star rating refers to StarRating = 1; saying, "Yuk, more like licorice soda" refers to Review = 'Yuk, more like licorice soda.';
SELECT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.CustomerID = 331115 AND T2.Review = 'Yuk, more like licorice soda.' AND T2.StarRating = 1
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
Write me the titles of the movies starring Jim Carrey.
Jim Carrey is the person_name;
SELECT T1.title FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Jim Carrey'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
How many times did Bob Peterson appear in the movie credits?
null
SELECT COUNT(T2.movie_id) FROM person AS T1 INNER JOIN movie_cast AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Bob Peterson'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
Give me the brewery and brand names of canned root beer that were purchased before 6/6/2015.
canned root beer refers to ContainerType = 'Can'; purchased before 6/6/2015 refers to PurchaseDate < '2015-06-06';
SELECT DISTINCT T2.BreweryName, T2.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T1.PurchaseDate < '2015-06-06' AND T1.ContainerType = 'Can'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
Give the names of the female cast in Movie No. 1865.
female cast refers to gender = 'Female'; name of cast refers to person_name; Movie No. 1865 refers to movie_id = 1865
SELECT T2.person_name FROM movie_cast AS T1 INNER JOIN person AS T2 ON T1.person_id = T2.person_id INNER JOIN gender AS T3 ON T1.gender_id = T3.gender_id WHERE T1.movie_id = 1865 AND T3.gender = 'Female'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
How many transactions were made in Sac State Union using the American Express credit card in 2014?
Sac State Union refers to LocationName = 'Sac State Union'; American Express credit card refers to CreditCardType = 'American Express'; in 2014 refers to TransactionDate LIKE '2014%';
SELECT COUNT(T1.TransactionID) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State Union' AND T1.CreditCardType = 'American Express' AND T1.TransactionDate BETWEEN '2014-01-01' AND '2014-12-31'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
How many films released between 1/2/1990 and 12/30/2000 starred Uma Thurman?
released between 1/2/1990 and 12/30/2000 refers to release_date BETWEEN '1990-01-02' AND '2000-12-30'; film has the same meaning as movie; starred Uma Thurman refers to person_name = 'Uma Thurman'
SELECT COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Uma Thurman' AND T1.release_date BETWEEN '1990-01-01' AND '2000-12-31'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
What is the average star rating given by female customers to brand ID 10018 from 1/25/2015 to 3/10/2015?
average star rating = AVG(StarRating); female customers refers to Gender = 'F; from 1/25/2015 to 3/10/2015 refers to ReviewDate BETWEEN '2015-01-25' AND '2015-03-10';
SELECT AVG(T2.StarRating) FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.BrandID = 10018 AND T1.Gender = 'F' AND T2.ReviewDate BETWEEN '2013-01-25' AND '2015-03-10'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
beer_factory
Calculate the total purchases made by customers using their Visa credit cards in the Sac State American River Courtyard between 6/3/2014 and 11/27/2015.
total purchases = SUM(PurchasePrice); Visa credit card refers to CreditCardType = 'Visa'; Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard'; between 6/3/2014 and 11/27/2015 refers to TransactionDate BETWEEN '2014-06-03' AND '2015-11-27';
SELECT SUM(T1.PurchasePrice) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State American River Courtyard' AND T1.CreditCardType = 'Visa' AND T1.TransactionDate BETWEEN '2014-06-03' AND '2015-11-27'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
Give the genre and popularity of movies whose revenue is at least 120,000,000 between 2012 and 2015.
genre refers to genre_name; revenue is at least 120,000,000 refers to revenue > = 120000000; between 2012 and 2015 refers to release_date BETWEEN '2012-01-01' AND '2015-12-31'
SELECT T3.genre_name, T1.popularity FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T1.revenue > 120000000 AND T1.release_date BETWEEN '2012-01-01' AND '2015-12-31'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
List the director's name of the movies released between 1/01/1916 and 12/31/1925.
director's name refers to person_name where job = 'Director'; released between 1/01/1916 and 12/31/1925 refers to release_date BETWEEN '1916-01-02' AND '1925-12-30'
SELECT T2.person_name FROM movie_cast AS T1 INNER JOIN person AS T2 ON T1.person_id = T2.person_id INNER JOIN movie AS T3 ON T1.movie_id = T3.movie_id INNER JOIN movie_crew AS T4 ON T1.movie_id = T4.movie_id WHERE T4.job = 'Director' AND T3.release_date BETWEEN '1916-01-01' AND '1925-12-31'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
Write the titles of horror films with a vote average of more than 7.
horror films refers to genre_name = 'Horror'; vote average of more than 7 refers to vote_average > 7
SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T3.genre_name = 'Horror' AND vote_average > 7
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
retail_complains
State the first name of male clients who did not receive timely response from the call center.
first name refers to first; male refers to sex = 'Male'; did not receive timely response refers to Timely response? = 'No'
SELECT T1.first FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Timely response?` = 'No' AND T1.sex = 'Male'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
law_episode
Write down the title, summary, and air date of the episode that garnered 72 10-star votes.
72 10-star votes refers to stars = 10 and votes = 72
SELECT T2.title, T2.summary, T2.air_date FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.stars = 10 AND T1.votes = 72
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
What is the average star rating of the episodes Jim Bracchitta has worked on?
average star rating = divide(sum(stars), count(episode_id)) where name = 'Jim Bracchitta'
SELECT CAST(SUM(T3.stars) AS REAL) / COUNT(T2.episode_id) FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.person_id = T2.person_id INNER JOIN Vote AS T3 ON T2.episode_id = T3.episode_id WHERE T3.stars = 1 AND T1.name = 'Jim Bracchitta'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
What percentage of people have worked on the True North episode as additional crew?
the True North episode refers to title = 'True North'; additional crew refers to role = 'Additional Crew'; percentage = divide(count(episode_id where role = 'Additional Crew'), count(episode_id)) * 100% where title = 'True North'
SELECT CAST(SUM(CASE WHEN T2.role = 'Additional Crew' THEN 1 ELSE 0 END) AS REAL ) * 100 / COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'True North'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Who is the winner of the Best Television Episode award for the Edgar category in 2000? Include his or her name and role.
the Best Television Episode award refers to award = 'Best Television Episode'; the Edgar category refers to award_category = 'Edgar'; in 2000 refers to year = 2000
SELECT T1.name, T2.role FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.year = 2000 AND T2.award_category = 'Edgar' AND T2.award = 'Best Television Episode'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Who is the narrator of the "Flight" episode?
who refers to name; narrator refers to role = 'Narrator'; the "Flight" episode refers to title = 'Flight'
SELECT T3.name FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.title = 'Flight' AND T2.role = 'Narrator'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Who was the Law and Order series writer who also won the Television Silver Gavel Award at the American Bar Association Silver Gavel Awards for Media and the Arts for two consecutive years?
who refers to name; writer refers to role = 'writer'; won refers to result = 'Winner'; the Television refers to award = 'Television'; Silver Gavel Award refers to award_category = 'Silver Gavel Award'; the American Bar Association Silver Gavel Awards for Media and the Arts refers to organization = 'American Bar Associa...
SELECT t3.name FROM ( SELECT DISTINCT T2.year AS years, T1.name, row_number() OVER (PARTITION BY T1.name ORDER BY T2.year) AS rm FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.award = 'Television' AND T2.award_category = 'Silver Gavel Award' AND T2.series = 'Law and Order' AND T2.resul...
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
How many 6-star votes did episode 12 get? Please include the air date and rating.
6-star vote refers to stars = 6
SELECT T2.air_date, T2.rating FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.stars = 6 AND T2.episode = 12
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Give me the years and episode IDs in which Constantine Makris was the winner of the Television Silver Gavel Award at the American Bar Association Silver Gavel Awards for Media and the Arts for two consecutive years.
the winner refers to result = 'Winner'; the Television refers to award = 'Television'; Silver Gavel Award refers to award_category = 'Silver Gavel Award'; the American Bar Association Silver Gavel Awards for Media and the Arts refers to organization = 'American Bar Association Silver Gavel Awards for Media and the Arts...
SELECT t3.years, t3.episode_id FROM ( SELECT DISTINCT T2.year AS years, T2.episode_id, row_number() OVER (PARTITION BY T2.episode_id ORDER BY T2.year) AS rm FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.award = 'Television' AND T2.award_category = 'Silver Gavel Award' AND T1.name = 'C...
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
On what episode did Julia Roberts win the "Outstanding Guest Actress in a Drama Series" award during the 1999 Primetime Emmy Awards? Tell me her role.
win refers to result = 'Winner'; the "Outstanding Guest Actress in a Drama Series" award refers to award = 'Outstanding Guest Actress in a Drama Series'; the 1999 refers to year = 1999; Primetime Emmy Awards refers to organization = 'Primetime Emmy Awards'
SELECT T3.episode_id, T2.role FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id INNER JOIN Episode AS T3 ON T2.episode_id = T3.episode_id WHERE T2.year = 1999 AND T2.award = 'Outstanding Guest Actress in a Drama Series' AND T2.organization = 'Primetime Emmy Awards' AND T1.name = 'Julia Roberts' AN...
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Write down the organization, year, award, and award category in which Rene Balcer is the winner.
Rene Balcer refers to name = 'Rene Balcer'; the winner refers to result = 'Winner'
SELECT T2.organization, T2.year, T2.award, T2.award_category FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T1.name = 'Rene Balcer' AND T2.result = 'Winner'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Among the American casts, how many were uncredited on episode ID tt0629228?
American refers to birth_country = 'USA'; cast refers to category = 'Cast'; uncredited refers to credited = ''
SELECT COUNT(T1.person_id) FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.episode_id = 'tt0629228' AND T1.category = 'Cast' AND T1.credited = 'false' AND T2.birth_country = 'USA'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
How many times was episode 20 of the Law and Order series nominated for the Primetime Emmy Awards in 1999?
nominated refers to result = 'nominee'; the Law and Order series refers to series = 'Law and Order'; the Primetime Emmy Awards refers to organization = 'Primetime Emmy Awards'; in 1999 refers to year = 1999
SELECT COUNT(T2.award_id) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.year = 1999 AND T2.result = 'Nominee' AND T1.episode = 20 AND T2.organization = 'Primetime Emmy Awards' AND T1.series = 'Law and Order'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
List down the titles of the top 3 episodes, from highest to lowest, in terms of their weighted stars.
weighted stars = divide(sum(stars, percent), 100)
SELECT T2.title FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.stars BETWEEN 1 AND 10 GROUP BY T2.title ORDER BY CAST(SUM(T1.stars * T1.percent) AS REAL) / 100 DESC LIMIT 3
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
List the titles and air dates of episodes that were produced by Billy Fox.
produced refers to role = 'producer'
SELECT T1.title, T1.air_date FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T2.category = 'Produced by' AND T2.role = 'producer' AND T3.name = 'Billy Fox'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Who played the role of the "president of NBC West Coast" in the first episode?
who refers to name; the role of the "president of NBC West Coast" refers to role = 'president of NBC West Coast'; the first episode refers to episode = 1
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id INNER JOIN Episode AS T3 ON T1.episode_id = T3.episode_id WHERE T3.episode = 1 AND T1.role = 'president of NBC West Coast'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
How many people from Canada are nominated for an award?
from Canada refers to birth_country = Canada; nominated refers to award is NOT NULL
SELECT COUNT(T1.person_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T1.birth_country = 'Canada'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
What was the role of Jason Kuschner in episode 9?
null
SELECT T1.role FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id INNER JOIN Episode AS T3 ON T1.episode_id = T3.episode_id WHERE T3.episode = 9 AND T2.name = 'Jason Kuschner'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
What is the ratio of American casts on episode 2 of the series? Please include their roles.
American refers to birth_country = 'USA'; cast refers to category = 'Cast'; ratio = divide(count(person_id where birth_country = 'USA'), total(category)) where category = 'Cast'
SELECT CAST(SUM(CASE WHEN T2.category = 'Cast' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.category), T1.role FROM Award AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Episode AS T3 ON T2.episode_id = T3.episode_id INNER JOIN Person AS T4 ON T2.person_id = T4.person_id WHERE T3.episode = 2 A...
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
List out all the credit names for episode 9.
credit name refers to name
SELECT T3.name FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.episode = 9
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
List the names of all the cast members in the series.
cast member refers to category = 'Cast'
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.category = 'Cast'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Which role have won at least two awards for the entire season and list out the name?
at least two awards refers to count(role) >1
SELECT T1.name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id GROUP BY T2.role HAVING COUNT(T2.award_id) > 1
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
How many episodes are credited to Jerry Orbach?
null
SELECT COUNT(T2.person_id) FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'Jerry Orbach'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
List out all award titles nominated for episode 20.
award title refers to title; nominated refers to result = 'Winner' or result = 'Nominee'
SELECT T2.award FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T1.episode = 20 AND T2.result IN ('Winner', 'Nominee')
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Which episodes are nominated for an awards but not win?
nominated for an award but not win refers to result = 'Nominee'
SELECT T1.episode FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.result = 'Nominee'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
What is the title of the episode that has the highest number of crews in the Art Department?
the highest number of crews refers to max(count(person_id)); in the Art Department refers to category = 'Art Department'
SELECT T2.title FROM Credit AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.category = 'Art Department' GROUP BY T2.episode_id ORDER BY COUNT(T1.category) DESC LIMIT 1
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
What is the difference of 10 stars votes between the first episode and the last episode?
the first episode refers to episode = 1; the last episode refers to episode = 24; 10 stars vote refers to stars = 10; the difference = subtract(votes where episode = 1, votes where episode = 24) where stars = 10
SELECT SUM(CASE WHEN T2.episode = 24 THEN T1.votes ELSE 0 END) - SUM(CASE WHEN T2.episode = 1 THEN T1.votes ELSE 0 END) FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.stars = 10
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
List out director names that received an award along with the episode number.
director refers to role = 'director'; received an award refers to result = 'Winner'; episode number refers to episode
SELECT T3.name, T1.episode_id FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T2.person_id = T3.person_id WHERE T2.role = 'director' AND T2.result = 'Winner'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
What is the average rating for each episode in season 9?
average rating = divide(sum(rating), count(episode_id))
SELECT SUM(rating) / COUNT(episode_id) FROM Episode WHERE season = 9
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
How many credits have been displayed from episode 1 until 10?
credit displayed refers to credited = 'true'; from episode 1 until 10 refers to episode > = 1 AND episode < = 10
SELECT COUNT(T1.person_id) FROM Credit AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.credited = 'true' AND T2.episode BETWEEN 1 AND 10
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Who is the youngest person to ever play a "clerk" role in the series?
who refers to name; the youngest person refers to max(birthdate); a "clerk" role refers to role = 'Clerk'
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.role = 'Clerk' AND T2.birthdate IS NOT NULL ORDER BY T2.birthdate LIMIT 1
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
What is the average star with highest percentage for episodes that have received award?
received award refers to result = 'Winner'; the highest percentage refers to max(percent); average star = divide(sum(stars), count(episode_id))
SELECT T2.person_id FROM Vote AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id ORDER BY T1.percent DESC LIMIT 1
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
What is the episode rating with the most award won?
the most award won refers to max(episode_id where result = 'Winner')
SELECT T1.rating FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.result = 'Winner' GROUP BY T1.episode_id ORDER BY COUNT(T2.award_id) DESC LIMIT 1
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
What is the episode that has mafia keyword?
mafia keyword refers to Keyword = 'mafia'
SELECT T1.episode FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.Keyword = 'mafia'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
How many winners have been awarded a Television award by the "American Bar Association Silver Gavel Awards for Media and the Arts"?
winner refers to result = 'Winner'; Television award refers to award = 'Television'; the "American Bar Association Silver Gavel Awards for Media and the Arts" refers to organization = 'American Bar Association Silver Gavel Awards for Media and the Arts'
SELECT COUNT(award_id) FROM Award WHERE result = 'Winner' AND award = 'Television' AND organization = 'American Bar Association Silver Gavel Awards for Media and the Arts'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Who is the stunt coordinator in episode 3?
who refers to name; stunt coordinator refers to role = 'stunt coordinator'
SELECT T3.name FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.episode = 3 AND T2.role = 'stunt coordinator'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Who was the nominee playing the role of Katrina Ludlow in the Law & Order series?
nominee refers to result = 'Nominee'; the role of Katrina Ludlow refers to role = 'Katrina Ludlow'
SELECT T2.name FROM Award AS T1 INNER JOIN Person AS T2 ON T1.person_id = T2.person_id WHERE T1.result = 'Nominee' AND T1.role = 'Katrina Ludlow' AND T1.series = 'Law and Order'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
What is the average ranking episodes that are nominated for an award?
average ranking = divide(sum(rating), sum(episode_id))
SELECT SUM(T1.rating) / COUNT(T1.episode) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Which continent was Michael Preston born on?
continent refers to birth_country
SELECT birth_country FROM Person WHERE name = 'Michael Preston'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
How many roles did Julia Roberts play in the series?
null
SELECT COUNT(T1.role) FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'Julia Roberts'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
What are the keywords of the episode which received the 2nd-highest number of votes?
the 2nd-highest number of votes refers to second max(votes)
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.votes NOT IN ( SELECT MAX(T1.votes) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id ) ORDER BY T1.votes DESC LIMIT 1
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Which episode has the highest total number of viewer votes?
episode refers to title; the highest total number of viewer votes refers to max(sum(votes))
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id GROUP BY T1.title ORDER BY SUM(T1.votes) DESC LIMIT 1
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Who played the role of a teleplay in the episode that won "Best Television Episode"?
the role of a teleplay refers to role = 'teleplay'; won refers to result = 'Winner'; "Best Television Episode" refers to award = 'Best Television Episode'
SELECT T2.name FROM Award AS T1 INNER JOIN Person AS T2 ON T1.person_id = T2.person_id WHERE T1.result = 'Winner' AND T1.award = 'Best Television Episode'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Which episode was nominated for the award for "Outstanding Costume Design for a Series"?
episode refers to title; "Outstanding Costume Design for a Series" refers to award = 'Outstanding Costume Design for a Series'
SELECT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.award = 'Outstanding Costume Design for a Series'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Where is the place of birth of the actor with the number nm0007064 who has not been credited for playing the role of a "Narrator"?
place of birth refers to birth_place; actor with the number nm0007064 refers to person_id = 'nm007064'; has not been credited refers to credited = ''; the role of a "Narrator" refers to role = 'narrator'
SELECT DISTINCT T1.birth_place FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.person_id = T2.person_id WHERE T1.person_id = 'nm0007064' AND T2.role = 'Narrator' AND T2.credited = 'false'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
What are the titles of the top 3 episodes that received no less than 30 votes in its 10-star rating?
no less than 30 votes refers to votes > = 30; 10-star rating refers to stars = 10
SELECT T2.title FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.votes >= 30 AND T1.stars = 10 ORDER BY T1.votes DESC LIMIT 3
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Who was the actor who was portraying "Alex Brown" and has been credited?
who refers to name; portraying "Alex Brown" refers to role = 'Alex Brown'; has been credited refers to credited = 'true'
SELECT T1.name FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.person_id = T2.person_id WHERE T2.role = 'Alex Brown' AND T2.credited = 'true'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Who are the actors with a height of over 1.80m in an episode that won an award?
who refers to name; a height of over 1.80m refers to height_meters > 1.80; won an award refers to result = 'Winner'
SELECT T2.name FROM Award AS T1 INNER JOIN Person AS T2 ON T1.person_id = T2.person_id WHERE T1.result = 'Winner' AND T2.height_meters > 1.80
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
What is the date of birth of the actor who played the role of a "writer"?
date of birth refers to birthdate
SELECT T2.birthdate FROM Award AS T1 INNER JOIN Person AS T2 ON T1.person_id = T2.person_id WHERE T1.role = 'writer'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
What are the keywords of the episode "Shield"?
the episode "Shield" refers to title = 'Shield'
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Shield'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Which episode number has the second highest positive viewer comments and has been awarded "Best Television Episode"?
episode number refers to episode_id; awarded "Best Television Episode" refers to award = 'Best Television Episode' and result = 'Winner'; the second highest positive viewer comments refers to rating = 8.5
SELECT T2.episode_id FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.award = 'Best Television Episode' AND T1.result = 'Winner' ORDER BY T2.rating DESC LIMIT 2
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
How many people were not credited at the end of the "Admissions" episode?
not credited refers to credited = ''; the "Admissions" episode refers to title = 'Admissions'
SELECT COUNT(T2.person_id) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Admissions' AND T2.credited = 'false'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
synthea
According to the observation on 2008/3/11, what was the height of Elly Koss?
2008/3/11 refers to date = '2008-03-11'; height refers to DESCRIPTION = 'Body Height' from observations;
SELECT T2.value, T2.units FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.date = '2008-03-11' AND T2.description = 'Body Height'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
law_episode
Which episode has the two keywords "nun" and "priest"?
episode refers to title; the two keywords "nun" and "priest" refers to keyword = 'nun' or keyword = 'priest';
SELECT T1.title FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.keyword IN ('nun', 'priest')
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Please list any three episodes that were most enjoyed by the viewers.
episode refers to title; most enjoyed by the viewers refers to stars = 10
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10 LIMIT 3
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
Which episodes of the Law & Order have been nominated for the Primetime Emmy Awards?
episode refers to award; the Primetime Emmy Awards refers to award_category like 'Primetime Emmy'
SELECT DISTINCT episode_id FROM Award WHERE award_category = 'Primetime Emmy'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
law_episode
How many people did not enjoy the finale episode?
did not enjoy refers to stars = 1; the finale episode refers to episode = 24
SELECT COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.episode = 24 AND T2.stars = 1
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
synthea
During all the observations of Elly Koss, what was the highest Systolic Blood Pressure observed?
the highest Systolic Blood Pressure refers to MAX(DESCRIPTION = 'Systolic Blood Pressure') from observations;
SELECT T2.value, T2.units FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description = 'Systolic Blood Pressure' ORDER BY T2.VALUE DESC LIMIT 1
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
law_episode
What roles have not been credited at the end of the episodes?
have not been credited refers to credited = ''
SELECT DISTINCT role FROM Credit WHERE credited = 'false'
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
synthea
By how much did Elly Koss's weight increase from the observation in 2008 to the observation in 2009?
SUBTRACT((DATE like '2009%'), (DATE like '2008%')) where DESCRIPTION = 'Body Weight';
SELECT SUM(CASE WHEN strftime('%Y', T2.date) = '2009' THEN T2.VALUE END) - SUM(CASE WHEN strftime('%Y', T2.date) = '2008' THEN T2.VALUE END) AS increase , T2.units FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description = 'Body Height'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
synthea
The highest Systolic Blood Pressure was observed in which patient? Please give his or her full name.
the highest Systolic Blood Pressure refers to MAX(DESCRIPTION = 'Systolic Blood Pressure') from observations; full name refers to first, last;
SELECT T1.first, T1.last FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T2.VALUE = ( SELECT MAX(VALUE) FROM observations WHERE description = 'Systolic Blood Pressure' ) LIMIT 1
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
law_episode
In which organization did Constantine Makris win the most awards?
win refers to result = 'Winner'; the most awards refers to max(count(award_id))
SELECT T2.organization FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T1.name = 'Constantine Makris' AND T2.result = 'Winner' GROUP BY T2.organization ORDER BY COUNT(T2.award_id) DESC LIMIT 1
CREATE TABLE Award ( result TEXT, -- Example Values: `Winner`, `Nominee` | Value Statics: Total count 22 - Distinct count 2 - Null count 0 person_id TEXT, -- Example Values: `nm0937725`, `nm0792309`, `nm0049569`, `nm0371065`, `nm0288886` | Value Statics: Total count 22 - Distinct count 13 - Null count 0 organi...
olympics
Which region has the most athletes?
region refers to region_name; the most athletes refer to MAX(COUNT(region_name));
SELECT T2.region_name FROM person_region AS T1 INNER JOIN noc_region AS T2 ON T1.region_id = T2.id GROUP BY T2.region_name ORDER BY COUNT(T1.person_id) DESC LIMIT 1
CREATE TABLE event ( event_name TEXT default NULL, -- sport_id INTEGER default NULL, -- foreign key (sport_id) references sport(id), id INTEGER not null primary key, ); CREATE TABLE sport ( id INTEGER not null primary key, sport_name TEXT default NULL, -- ); CREATE TABLE city ( city_name TEXT default NUL...