context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
Which behavior category does user number 5902120154267990000 belong to?
SELECT T1.category FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T2.app_id = 5902120154267990000
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
How many users belong to the same behavior category as comics?
SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T1.category = 'comics'
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
What is the age and gender of the person who uses the device number 29182687948017100 on event number 1?
SELECT T1.age, T1.gender FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T1.device_id = 29182687948017100 AND T2.event_id = 1
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
How many male users have the log of events at the same longitude of 114?
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T2.longitude = 114 AND T1.gender = 'M'
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
When did event number 7 happen for user number -8022267440849930000?
SELECT T1.timestamp FROM events_relevant AS T1 INNER JOIN app_events AS T2 ON T1.event_id = T2.event_id WHERE T2.app_id = -8022267440849930000 AND T1.event_id = 7
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
What are the behavior categories that user number -9222198347540750000 belongs to?
SELECT T3.category FROM app_all AS T1 INNER JOIN app_labels AS T2 ON T1.app_id = T2.app_id INNER JOIN label_categories AS T3 ON T2.label_id = T3.label_id WHERE T1.app_id = -9222198347540750000
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
Please provide the age group of any LG Nexus 4 device users.
SELECT T1.`group` FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'LG' AND T2.device_model = 'Nexus 4'
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
Please provide the gender of at least one user who owns an HTC Desire 826 device.
SELECT T1.gender FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Desire 826' AND T2.phone_brand = 'HTC'
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
What is the percentage of users who are in the same behavior category as "Academic Information"?
SELECT SUM(IIF(T1.category = 'Academic Information', 1.0, 0)) / COUNT(T2.app_id) AS per FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
What is the percentage of device users in the F27-28 age group who experienced an event on the 3rd of May 2016?
SELECT SUM(IIF(T1.`group` = 'F27-28', 1, 0)) / COUNT(T1.device_id) AS per FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE SUBSTR(T2.timestamp, 1, 10) = '2016-05-03'
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
How many OPPO devices are there?
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE phone_brand = 'OPPO'
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
What is the most common age group among all device users?
SELECT T.num FROM ( SELECT `group`, COUNT(`group`) AS num FROM gender_age GROUP BY `group` ) T
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
How many events does the device "4069764298338760000" have?
SELECT COUNT(event_id) FROM events WHERE device_id = 4069764298338760000
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
How many of the apps belong in the "Equity Fund" category?
SELECT COUNT(T1.app_id) FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id WHERE T2.category = 'Equity Fund'
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
List all females aged 24 to 26 devices' locations.
SELECT T2.longitude, T2.latitude FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T1.`group` = 'F24-26' AND T1.gender = 'F'
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
How many male users have a Galaxy Note 3?
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Galaxy Note 3' AND T1.gender = 'M'
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
List all the devices' brands and models of events on 5/7/2016 at 6:03:22 AM.
SELECT T1.phone_brand, T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T2.timestamp = '2016-05-07 06:03:22'
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
Which brand is most common among people in their twenties?
SELECT T.phone_brand FROM ( SELECT T2.phone_brand, COUNT(T2.phone_brand) AS num FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.age BETWEEN 20 AND 30 GROUP BY T2.phone_brand ) AS T ORDER BY T.num DESC LIMIT 1
bird
CREATE TABLE talkingdata (app_id integer, event_id integer, app_id integer, is_installed integer, is_active integer, event_id integer, app_id integer, is_installed integer, is_active integer, app_id integer, label_id integer, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, event_id integer, device_id integer, timestamp datetime, longitude real, latitude real, device_id integer, gender text, age integer, group text, device_id integer, device_id integer, gender text, age integer, group text, label_id integer, category text, device_id integer, phone_brand text, device_model text, device_id integer, F23- real, F24-26 real, F27-28 real, F29-32 real, F33-42 real, F43+ real, M22- real, M23-26 real, M27-28 real, M29-31 real, M32-38 real, M39+ real)
What percentage of vivo devices belong to users with no information?
SELECT SUM(IIF(T1.gender IS NULL AND T1.age IS NULL AND T1.`group` IS NULL, 1, 0)) / COUNT(T1.device_id) AS per FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'vivo'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Please list all the keywords of the episode "Refuge: Part 1".
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Refuge: Part 1'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many keywords are there for season 9, episode 23 of law_and_order?
SELECT COUNT(T2.keyword) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.season = 9 AND T1.episode = 23
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What is the title of the episode with the keyword "laundering money"?
SELECT T1.title FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.keyword = 'laundering money'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Please list all the keywords for the episodes with a rating of over 8.
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.rating > 8
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many 10-star votes were given to the episode titled "Cherished"?
SELECT T2.votes FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Cherished' AND T2.stars = 10
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many votes did the episode titled "Cherished" get in total?
SELECT SUM(T2.votes) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Cherished'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What is the title of the episode that got the most 10-star votes?
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10 ORDER BY T2.votes DESC LIMIT 1
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Park Dietz was credited in which role in the episode titled "Cherished"?
SELECT T2.role 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 = 'Cherished' AND T3.name = 'Park Dietz' AND T2.credited = 'true'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many people had filled a role in the episode titled "Cherished", but did not show up in the on-screen credits?
SELECT COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Cherished' AND T2.credited = 'false'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Who was credited as "technical advisor" in the episode titled "Cherished"?
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 = 'Cherished' AND T2.credited = 'true' AND T2.role = 'technical advisor'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
For how many times was Park Dietz credited?
SELECT COUNT(T3.person_id) 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.credited = 'true' AND T3.name = 'Park Dietz'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Please list the titles of all the episodes in which Park Dietz was credited.
SELECT T1.title 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.credited = 'true' AND T3.name = 'Park Dietz'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Was Anthony Azzara's role in episode tt0629204 displayed in the credits at the end of the episode?
SELECT T1.credited FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'Anthony Azzara' AND T1.episode_id = 'tt0629204'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many keywords are there in the episode Disciple?
SELECT COUNT(T2.keyword) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Disciple'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Which episode got the most 1 star votes? Give its title.
SELECT T2.title FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.stars = 1 ORDER BY T1.votes DESC LIMIT 1
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many nominations did Law and Order season 9, episode 20 get?
SELECT COUNT(T2.award_id) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.series = 'Law and Order' AND T1.season = 9 AND T1.episode = 20
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
For season 9, episode 17 of the show Law and Order, how many roles have been included in the credit?
SELECT COUNT(T2.role) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.series = 'Law and Order' AND T1.season = 9 AND T1.episode = 17 AND T2.credited = 'true'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Describe what happened in the episode of award no.296.
SELECT T1.summary FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.award_id = 296
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Which role did Joseph Blair play in the show?
SELECT T1.role FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'Joseph Blair'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many awards has Rene Balcer been nominated for?
SELECT COUNT(T2.award_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T1.name = 'Rene Balcer'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
For the episode with the most votes, give its air date.
SELECT T2.air_date FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id GROUP BY T2.episode_id ORDER BY SUM(T1.votes) DESC LIMIT 1
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Who was nominated for award no.313? Give the full name.
SELECT T1.name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.award_id = 313
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many episodes did J.K. Simmons' role appear on the show?
SELECT COUNT(T1.role) FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'J.K. Simmons'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Display the number of 9-star votes the episode Sideshow received.
SELECT T2.votes FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 9 AND T1.title = 'Sideshow'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many times is the number of keywords in "Refuge: Part 1" episode than "Shield" episode?
SELECT CAST(SUM(CASE WHEN T1.title = 'Refuge: Part 1' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.title = 'Shield' THEN 1 ELSE 0 END) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Calculate the average number of cast members that appeared in the credit from the 185th to the 193rd episode.
SELECT CAST(COUNT(T1.episode_id) AS REAL) / (193 - 185 + 1) FROM Credit AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.category = 'Cast' AND T1.credited = 'true' AND T2.number_in_series BETWEEN 185 AND 193
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What are the names of the person that were not credited at the end of episode tt0629391?
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.credited = 'false' AND T1.episode_id = 'tt0629391'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many people have won at least 3 awards?
SELECT COUNT(T1.person_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.result = 'Winner' GROUP BY T1.person_id HAVING COUNT(T2.award_id) >= 3
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Who is the script supervisor of the series in episode tt0629204?
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.episode_id = 'tt0629204' AND T1.role = 'script supervisor'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many awards has Julia Roberts been nominated for?
SELECT COUNT(T2.award_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T1.name = 'Julia Roberts' AND T2.result = 'Nominee'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Who is the tallest camera operator?
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.role = 'camera operator' ORDER BY T2.height_meters DESC LIMIT 1
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many people, who were born in Canada, won an award in 1999?
SELECT COUNT(T1.person_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.year = 1999 AND T1.birth_country = 'Canada'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many people gave the most enjoyed episode a 10-star rating?
SELECT COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What are the keywords of the "Shield" episode?
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Shield'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What is the percentage of people who gave the "True North" episode a 1-star rating?
SELECT CAST(SUM(CASE WHEN T2.stars = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'True North' AND T1.episode_id = 'tt0629477'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What is the title of the episode with the highest number of keywords?
SELECT T1.title FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id GROUP BY T1.episode_id ORDER BY COUNT(T2.keyword) DESC LIMIT 1
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Among the episodes that were aired in 1998, how many won an International Monitor Awards?
SELECT COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE strftime('%Y', T1.air_date) = '1998' AND T2.organization = 'International Monitor Awards' AND T2.result = 'Winner'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many times did the episode titled "Agony" win an award?
SELECT COUNT(T2.award_id) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Agony' AND T2.result = 'Winner'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many episodes are there in the 9th season of Law and Order? Calculate the average number of casts per season of the said series.
SELECT SUM(CASE WHEN T2.season = 9 THEN 1 ELSE 0 END) AS num , CAST(SUM(CASE WHEN T2.season = 9 THEN 1 ELSE 0 END) AS REAL) / COUNT(T1.episode_id) FROM Credit AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.category = 'Cast' AND T2.series = 'Law and Order'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What are the keywords of the episode which received the 2nd-highest number of 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
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many awards did the "Agony" win?
SELECT COUNT(T2.award) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Agony' AND T2.result = 'Winner'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Who is the narrator of the "Flight" episode?
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'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
In which organization did Constantine Makris win the most awards?
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
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Who is the stunt coordinator in episode 3?
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'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many people were not credited at the end of the "Admissions" episode?
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'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What is the title of the episode that has the highest number of crews in the 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
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many roles did Julia Roberts play in the series?
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'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What are the titles of the top 3 episodes that received no less than 30 votes in its 10-star rating?
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
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Who is the youngest person to ever play a "clerk" role in the series?
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
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many people did not enjoy the finale episode?
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
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
List the names of all the cast members in the series.
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.category = 'Cast'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Who is the person who appeared the most in the series? Calculate in percentage how many times he or she appeared.
SELECT T2.person_id, CAST(COUNT(T2.person_id) AS REAL) * 100 / ( SELECT COUNT(T2.person_id) AS num FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id ) AS per FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id GROUP BY T2.person_id ORDER BY COUNT(T2.person_id) DESC LIMIT 1
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Which episodes of the Law & Order have been nominated for the Primetime Emmy Awards?
SELECT DISTINCT episode_id FROM Award WHERE award_category = 'Primetime Emmy'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many episodes have not won any Law & Order series awards?
SELECT COUNT(award_id) FROM Award WHERE Result = 'Nominee'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What roles have not been credited at the end of the episodes?
SELECT DISTINCT role FROM Credit WHERE credited = 'false'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What is the title of the 3 worst rated episodes?
SELECT title FROM Episode ORDER BY rating LIMIT 3
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What is the full place of birth of Rene Chenevert Balcer?
SELECT birth_place, birth_region FROM Person WHERE birth_name = 'Rene Chenevert Balcer'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What is the name of the actors born in the USA?
SELECT name FROM Person WHERE birth_country = 'USA'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What is the title of the episodes that were least enjoyed?
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 1
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What are the names of the two people who won an award for their role as directors?
SELECT T1.name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.Result = 'Winner' AND T2.role = 'director'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many votes did the episode titled Juvenile get?
SELECT SUM(T2.votes) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Juvenile'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
In which episodes was Anthony Azzara not credited?
SELECT T1.title 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.credited = 'false' AND T3.name = 'Anthony Azzara'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
In what year did the episodes titled DWB get an award?
SELECT DISTINCT T1.year FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.title = 'DWB' AND T1.result = 'Winner'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
In which region were the assistant location managers born?
SELECT T2.birth_region FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.role = 'president of NBC West Coast'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many stars did the episodes in which Donna Villella worked?
SELECT COUNT(T3.person_id) 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 T3.name = 'Donna Villella'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What role was Julia Roberts nominated for?
SELECT T2.role FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.Result = 'Nominee' AND T1.name = 'Julia Roberts'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What role does the tallest person play?
SELECT T2.role FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.person_id = T2.person_id INNER JOIN Award AS T3 ON T2.episode_id = T3.episode_id ORDER BY T1.height_meters DESC LIMIT 1
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What is the title of the episode with the most nominations?
SELECT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.result = 'Nominee' GROUP BY T2.episode_id ORDER BY COUNT(T1.result) DESC LIMIT 1
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What was the rating of the episodes that Jace Alexander worked on?
SELECT T1.rating 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 T3.name = 'Jace Alexander'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What are the names of all the people who worked on episode 19 of season 9?
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 = 19 AND T1.season = 9
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What is the average star rating of the episodes Jim Bracchitta has worked on?
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'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
What percentage of people have worked on the True North episode as additional crew?
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'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Write down the title, summary, and air date of the episode that garnered 72 10-star votes.
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
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many 6-star votes did episode 12 get? Please include the air date and rating.
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
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Who is the winner of the Best Television Episode award for the Edgar category in 2000? Include his or her name and role.
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'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
Write down the organization, year, award, and award category in which Rene Balcer is the 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'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
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.
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 = 'Constantine Makris' AND T2.result = 'Winner' AND T2.organization = 'American Bar Association Silver Gavel Awards for Media and the Arts' ) AS T3 GROUP BY t3.episode_id HAVING COUNT(t3.years - t3.rm) >= 2
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
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?
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.result = 'Winner' AND T2.organization = 'American Bar Association Silver Gavel Awards for Media and the Arts' ) AS T3 GROUP BY t3.name HAVING COUNT(t3.years - t3.rm) >= 2
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
How many times was episode 20 of the Law and Order series nominated for the Primetime Emmy Awards in 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'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
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.
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' AND T2.result = 'Nominee'
bird
CREATE TABLE law_episode (episode_id text, series text, season integer, episode integer, number_in_series integer, title text, summary text, air_date date, episode_image text, rating real, votes integer, episode_id text, keyword text, person_id text, name text, birthdate date, birth_name text, birth_place text, birth_region text, birth_country text, height_meters real, nickname text, award_id integer, organization text, year integer, award_category text, award text, series text, episode_id text, person_id text, role text, result text, episode_id text, person_id text, category text, role text, credited text, episode_id text, stars integer, votes integer, percent real)
List the titles and air dates of episodes that were produced by Billy Fox.
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'
bird