problem
stringlengths
121
422
db_id
stringclasses
69 values
solution
stringlengths
23
804
Write SQL query to solve given problem: When did event number 2 happen and how many users were active?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
SELECT COUNT(T1.app_id) AS num FROM app_events AS T1 INNER JOIN events AS T2 ON T1.event_id = T2.event_id WHERE T1.event_id = 2 AND T1.is_active = 1 GROUP BY T2.timestamp
Write SQL query to solve given problem: Which behavior category does user number 5902120154267990000 belong to?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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
Write SQL query to solve given problem: How many users belong to the same behavior category as comics?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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'
Write SQL query to solve given problem: What is the age and gender of the person who uses the device number 29182687948017100 on event number 1?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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
Write SQL query to solve given problem: How many male users have the log of events at the same longitude of 114?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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'
Write SQL query to solve given problem: When did event number 7 happen for user number -8022267440849930000?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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
Write SQL query to solve given problem: What are the behavior categories that user number -9222198347540750000 belongs to?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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
Write SQL query to solve given problem: Please provide the age group of any LG Nexus 4 device users.. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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'
Write SQL query to solve given problem: Please provide the gender of at least one user who owns an HTC Desire 826 device.. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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'
Write SQL query to solve given problem: What is the percentage of users who are in the same behavior category as "Academic Information"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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
Write SQL query to solve given problem: What is the percentage of device users in the F27-28 age group who experienced an event on the 3rd of May 2016?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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'
Write SQL query to solve given problem: How many OPPO devices are there?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE phone_brand = 'OPPO'
Write SQL query to solve given problem: What is the most common age group among all device users?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
SELECT T.num FROM ( SELECT `group`, COUNT(`group`) AS num FROM gender_age GROUP BY `group` ) T
Write SQL query to solve given problem: How many events does the device "4069764298338760000" have?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
SELECT COUNT(event_id) FROM events WHERE device_id = 4069764298338760000
Write SQL query to solve given problem: How many of the apps belong in the "Equity Fund" category?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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'
Write SQL query to solve given problem: List all females aged 24 to 26 devices' locations.. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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'
Write SQL query to solve given problem: How many male users have a Galaxy Note 3?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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'
Write SQL query to solve given problem: List all the devices' brands and models of events on 5/7/2016 at 6:03:22 AM.. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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'
Write SQL query to solve given problem: Which brand is most common among people in their twenties?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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
Write SQL query to solve given problem: What percentage of vivo devices belong to users with no information?. Keep the solution inside sql tag ```sql [SQL-Query] ```
talkingdata
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'
Write SQL query to solve given problem: Please list all the keywords of the episode "Refuge: Part 1".. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: How many keywords are there for season 9, episode 23 of law_and_order?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: What is the title of the episode with the keyword "laundering money"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT T1.title FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.keyword = 'laundering money'
Write SQL query to solve given problem: Please list all the keywords for the episodes with a rating of over 8.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.rating > 8
Write SQL query to solve given problem: How many 10-star votes were given to the episode titled "Cherished"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: How many votes did the episode titled "Cherished" get in total?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT SUM(T2.votes) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Cherished'
Write SQL query to solve given problem: What is the title of the episode that got the most 10-star votes?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: Park Dietz was credited in which role in the episode titled "Cherished"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: How many people had filled a role in the episode titled "Cherished", but did not show up in the on-screen credits?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: Who was credited as "technical advisor" in the episode titled "Cherished"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_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 = 'Cherished' AND T2.credited = 'true' AND T2.role = 'technical advisor'
Write SQL query to solve given problem: For how many times was Park Dietz credited?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: Please list the titles of all the episodes in which Park Dietz was credited.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: Was Anthony Azzara's role in episode tt0629204 displayed in the credits at the end of the episode?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_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'
Write SQL query to solve given problem: How many keywords are there in the episode Disciple?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT COUNT(T2.keyword) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Disciple'
Write SQL query to solve given problem: Which episode got the most 1 star votes? Give its title.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: How many nominations did Law and Order season 9, episode 20 get?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: For season 9, episode 17 of the show Law and Order, how many roles have been included in the credit?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: Describe what happened in the episode of award no.296.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT T1.summary FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.award_id = 296
Write SQL query to solve given problem: Which role did Joseph Blair play in the show?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT T1.role FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'Joseph Blair'
Write SQL query to solve given problem: How many awards has Rene Balcer been nominated for?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: For the episode with the most votes, give its air date.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: Who was nominated for award no.313? Give the full name.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT T1.name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T2.award_id = 313
Write SQL query to solve given problem: How many episodes did J.K. Simmons' role appear on the show?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: Display the number of 9-star votes the episode Sideshow received.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: How many times is the number of keywords in "Refuge: Part 1" episode than "Shield" episode?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_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
Write SQL query to solve given problem: Calculate the average number of cast members that appeared in the credit from the 185th to the 193rd episode.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_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
Write SQL query to solve given problem: What are the names of the person that were not credited at the end of episode tt0629391?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: How many people have won at least 3 awards?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: Who is the script supervisor of the series in episode tt0629204?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: How many awards has Julia Roberts been nominated for?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: Who is the tallest camera operator?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: How many people, who were born in Canada, won an award in 1999?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: How many people gave the most enjoyed episode a 10-star rating?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: What are the keywords of the "Shield" episode?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Shield'
Write SQL query to solve given problem: What is the percentage of people who gave the "True North" episode a 1-star rating?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: What is the title of the episode with the highest number of keywords?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: Among the episodes that were aired in 1998, how many won an International Monitor Awards?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: How many times did the episode titled "Agony" win an award?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: What are the keywords of the episode which received the 2nd-highest number of votes?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: How many awards did the "Agony" win?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: Who is the narrator of the "Flight" episode?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_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'
Write SQL query to solve given problem: In which organization did Constantine Makris win the most awards?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: Who is the stunt coordinator in episode 3?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_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.episode = 3 AND T2.role = 'stunt coordinator'
Write SQL query to solve given problem: How many people were not credited at the end of the "Admissions" episode?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_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'
Write SQL query to solve given problem: What is the title of the episode that has the highest number of crews in the Art Department?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: How many roles did Julia Roberts play in the series?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: What are the titles of the top 3 episodes that received no less than 30 votes in its 10-star rating?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: Who is the youngest person to ever play a "clerk" role in the series?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: How many people did not enjoy the finale episode?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_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
Write SQL query to solve given problem: List the names of all the cast members in the series.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.category = 'Cast'
Write SQL query to solve given problem: Who is the person who appeared the most in the series? Calculate in percentage how many times he or she appeared.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: Which episodes of the Law & Order have been nominated for the Primetime Emmy Awards?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT DISTINCT episode_id FROM Award WHERE award_category = 'Primetime Emmy'
Write SQL query to solve given problem: How many episodes have not won any Law & Order series awards?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT COUNT(award_id) FROM Award WHERE Result = 'Nominee'
Write SQL query to solve given problem: What roles have not been credited at the end of the episodes?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT DISTINCT role FROM Credit WHERE credited = 'false'
Write SQL query to solve given problem: What is the title of the 3 worst rated episodes?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT title FROM Episode ORDER BY rating LIMIT 3
Write SQL query to solve given problem: What is the full place of birth of Rene Chenevert Balcer?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT birth_place, birth_region FROM Person WHERE birth_name = 'Rene Chenevert Balcer'
Write SQL query to solve given problem: What is the name of the actors born in the USA?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT name FROM Person WHERE birth_country = 'USA'
Write SQL query to solve given problem: What is the title of the episodes that were least enjoyed?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 1
Write SQL query to solve given problem: What are the names of the two people who won an award for their role as directors?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: How many votes did the episode titled Juvenile get?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
SELECT SUM(T2.votes) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Juvenile'
Write SQL query to solve given problem: In which episodes was Anthony Azzara not credited?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: In what year did the episodes titled DWB get an award?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: In which region were the assistant location managers born?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: How many stars did the episodes in which Donna Villella worked?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: What role was Julia Roberts nominated for?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: What role does the tallest person play?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: What is the title of the episode with the most nominations?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: What was the rating of the episodes that Jace Alexander worked on?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: What are the names of all the people who worked on episode 19 of season 9?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_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.episode = 19 AND T1.season = 9
Write SQL query to solve given problem: What is the average star rating of the episodes Jim Bracchitta has worked on?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: What percentage of people have worked on the True North episode as additional crew?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: Write down the title, summary, and air date of the episode that garnered 72 10-star votes.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: How many 6-star votes did episode 12 get? Please include the air date and rating.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: Who is the winner of the Best Television Episode award for the Edgar category in 2000? Include his or her name and role.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: Write down the organization, year, award, and award category in which Rene Balcer is the winner.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: 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?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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
Write SQL query to solve given problem: How many times was episode 20 of the Law and Order series nominated for the Primetime Emmy Awards in 1999?. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ```
law_episode
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'