Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
479 B
4
Indexable
Never
SELECT c.name AS name_category,
      COUNT(DISTINCT fc.film_id) AS total_films
FROM actor AS a
LEFT OUTER JOIN film_actor AS fa ON a.actor_id = fa.actor_id
LEFT OUTER JOIN film_category AS fc ON fc.film_id = fa.film_id
LEFT OUTER JOIN category AS c ON c.category_id = fc.category_id
LEFT OUTER JOIN movie AS m ON fc.film_id = m.film_id
WHERE m.release_year > '2013'
GROUP BY name_category
HAVING COUNT(DISTINCT fa.film_id) > 7
ORDER BY total_films DESC, name_category;