Advertisement
AliaksandrLet

Версия 3

Jun 19th, 2022 (edited)
68
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(fc.film_id) AS total_films
  4. FROM
  5.     category AS c
  6.     INNER JOIN film_category AS fc ON fc.category_id = c.category_id
  7. WHERE
  8.     fc.film_id IN (
  9.         SELECT
  10.             m.film_id
  11.         FROM
  12.             movie AS m
  13.             INNER JOIN film_actor AS fa ON fa.film_id = m.film_id
  14.         WHERE
  15.             m.release_year > 2013
  16.         GROUP BY
  17.             m.film_id
  18.         HAVING
  19.             COUNT(fa.actor_id) > 7
  20.     )
  21. GROUP BY
  22.     name_category
  23. ORDER BY
  24.     total_films DESC,
  25.     name_category
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement