Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT c.name AS name_category,
- COUNT(DISTINCT m.film_id) AS total_films
- FROM category AS c
- FULL JOIN film_category AS fc ON c.category_id=fc.category_id
- FULL JOIN
- (SELECT film_id
- FROM movie AS m
- WHERE release_year > 2013) AS m ON m.film_id=fc.film_id
- WHERE m.film_id IN (SELECT fa.film_id
- FROM film_actor AS fa
- GROUP BY fa.film_id
- HAVING COUNT(fa.actor_id) > 7
- )
- GROUP BY name_category
- ORDER BY total_films DESC, name_category;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement