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