Advertisement
korenizla

Тема 5 Урок 3 Задача 3

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