programming-examples/sql/SQLMovieDatabase/44. Write a query in SQL to find the first and last name of an actor with their role in the movie which was also directed by themselve.sql
2019-11-18 14:05:53 +01:00

14 lines
520 B
SQL

/*44. Write a query in SQL to find the first and last name of an actor with their role in the movie which was also directed
by themselve. */
SELECT act_fname, act_lname, mov_title, role
FROM actor
JOIN movie_cast
ON actor.act_id=movie_cast.act_id
JOIN movie_direction
ON movie_cast.mov_id=movie_direction.mov_id
JOIN director
ON movie_direction.dir_id=director.dir_id
JOIN movie
ON movie.mov_id=movie_direction.mov_id
WHERE act_fname=dir_fname
AND act_lname=dir_lname;