Advertisement
Alaricy

Untitled

Jul 17th, 2024
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2. c.name AS name_category,
  3. COUNT(DISTINCT(fa.film_id)) AS total_films
  4. FROM
  5. film_category AS fc
  6. INNER JOIN category AS c ON c.category_id=fc.category_id
  7. INNER JOIN film_actor AS fa ON fa.film_id=fc.film_id
  8. WHERE fa.actor_id IN
  9.     (
  10.     SELECT
  11.     actor_id
  12.     FROM
  13.     film_category AS fc
  14.     INNER JOIN film_actor AS fa ON fa.film_id=fc.film_id
  15.     INNER JOIN movie AS m ON  fc.film_id=m.film_id
  16.     WHERE m.release_year>2013
  17.     GROUP BY actor_id
  18.     HAVING COUNT(actor_id)>7
  19.     ORDER BY COUNT(actor_id) DESC
  20.     )
  21. GROUP BY c.name
  22. ORDER BY COUNT(c.name) DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement