You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
448 B
SQL

/*42. Write a query in SQL to find the movie title, actor first and last name, and the role for those movies where one or
more actors acted in two or more movies. */
SELECT mov_title, act_fname, act_lname, role
FROM movie
JOIN movie_cast
ON movie_cast.mov_id=movie.mov_id
JOIN actor
ON movie_cast.act_id=actor.act_id
WHERE actor.act_id IN (
SELECT act_id
FROM movie_cast
GROUP BY act_id HAVING COUNT(*)>=2);