Posted by Esin Seçil, Feb. 17, 2024, 5:09 p.m.
1. Productive actors vs less-productive actors
I tried to solve this question with CTEs below. Then I submitted it.
WITH actors_filmcount AS (
SELECT
A.actor_id,
COUNT(DISTINCT FA.film_id) AS film_count
FROM actor AS A
INNER JOIN film_actor AS FA ON FA.actor_id = A.actor_id
GROUP BY A.actor_id
)
SELECT
CASE
WHEN film_count >= 30 THEN 'productive'
ELSE 'less productive'
END AS actor_category,
COUNT(*) AS category_count
FROM actors_filmcount
GROUP BY actor_category;
-----
My result is
actor_category | count
less_productive 124 (your result for this row is 126)
productive 74
I didn't understand why your answer is different. Where am I missing 2 value ?