Obviously you can replace the CTE with some form of View. Just a novel use of a hashing function to identify genres and counts to tie the actors together in the genre.
CREATE TABLE #ActorMovie (
a_name VARCHAR(100),
a_YofB INT,
m_title VARCHAR(100),
m_year INT
);
CREATE TABLE #Movie (
title VARCHAR(100),
year INT,
genre VARCHAR(50),
budget DECIMAL(15,2),
cost DECIMAL(15,2),
gross_earnings DECIMAL(15,2)
);
INSERT INTO #Movie (title, year, genre, budget, cost, gross_earnings) VALUES
('Iron Man', 2008, 'Action', 140000000, 100000000, 585000000),
('Avengers: Endgame', 2019, 'Action', 356000000, 200000000, 2797501328),
('Forrest Gump', 1994, 'Drama', 55000000, 30000000, 678200000),
('Harry Potter and the Sorcerer''s Stone', 2001, 'Fantasy', 125000000, 90000000, 974755371);
INSERT INTO #ActorMovie (a_name, a_YofB, m_title, m_year) VALUES ('Robert Downey Jr.', 1965, 'Iron Man', 2008)
INSERT INTO #ActorMovie (a_name, a_YofB, m_title, m_year) VALUES('Scarlett Johansson', 1984, 'Iron Man', 2008)
INSERT INTO #ActorMovie (a_name, a_YofB, m_title, m_year) VALUES('Tom Hanks', 1956, 'Forrest Gump', 1994)
INSERT INTO #ActorMovie (a_name, a_YofB, m_title, m_year) VALUES('Emma Watson', 1990, 'Harry Potter and the Sorcerer''s Stone', 2001)
INSERT INTO #ActorMovie (a_name, a_YofB, m_title, m_year) VALUES('Leonardo DiCaprio', 1974, 'Inception', 2010)
INSERT INTO #ActorMovie (a_name, a_YofB, m_title, m_year) VALUES('Scarlett Johansson', 1984, 'Avengers: Endgame', 2019)
INSERT INTO #ActorMovie (a_name, a_YofB, m_title, m_year) VALUES('Robert Downey Jr.', 1965, 'Avengers: Endgame', 2019)
INSERT INTO #ActorMovie (a_name, a_YofB, m_title, m_year) VALUES('Jennifer Lawrence', 1990, 'The Hunger Games', 2012)
INSERT INTO #ActorMovie (a_name, a_YofB, m_title, m_year) VALUES('Brad Pitt', 1963, 'Fight Club', 1999)
INSERT INTO #ActorMovie (a_name, a_YofB, m_title, m_year) VALUES('Johnny Depp', 1963, 'Pirates of the Caribbean', 2003)
INSERT INTO #ActorMovie (a_name, a_YofB, m_title, m_year) VALUES('Keira Knightley', 1985, 'Pirates of the Caribbean', 2003)
INSERT INTO #ActorMovie (a_name, a_YofB, m_title, m_year) VALUES('Orlando Bloom', 1977, 'Pirates of the Caribbean', 2003)
INSERT INTO #ActorMovie (a_name, a_YofB, m_title, m_year) VALUES('Natalie Portman', 1981, 'Thor', 2011)
INSERT INTO #ActorMovie (a_name, a_YofB, m_title, m_year) VALUES('Chris Hemsworth', 1983, 'Thor', 2011)
;with actor_move as
(select a_name, genre, count(*) as count_, LOWER(CONVERT(VARCHAR(32),
HashBytes('MD5', CONVERT(varchar(4000), genre + convert(varchar(1000), count(*)) )),2)) as id
from #ActorMovie as am join #Movie as m on m.title = am.m_title and m.[year] = am.m_year
group by a_name, genre)
;with actor_move as
(select a_name, genre, count(*) as count_, LOWER(CONVERT(VARCHAR(32),
HashBytes('MD5', CONVERT(varchar(4000), genre + convert(varchar(1000), count(*)) )),2)) as id
from #ActorMovie as am join #Movie as m on m.title = am.m_title and m.[year] = am.m_year
group by a_name, genre)
select * into #actorgenre from actor_move; -- can filter on genres here
select a_name from #actorgenre where id in
(select id from #actorgenre
group by id having count(id) > 1)
group by a_name having count(a_name) > 1
-- or filter on genres here
drop table #ActorMovie
drop table #Movie
drop table #actorgenre