SQL exercises on movie Database: Find the name of the director who directed a movie that casted a role for 'Eyes Wide Shut'
SQL movie Database: Subquery Exercise-2 with Solution
2. Write a query in SQL to find the name of the director (first and last names) who directed a movie that casted a role for 'Eyes Wide Shut'.
Sample table: director
Sample table: movie_direction
Sample table: movie_cast
Sample table: movie
SELECT dir_fname, dir_lname FROM director WHERE dir_id in ( SELECT dir_id FROM movie_direction WHERE mov_id in( SELECT mov_id FROM movie_cast WHERE role = ANY ( SELECT role FROM movie_cast WHERE mov_id IN ( SELECT mov_id FROM movie WHERE mov_title='Eyes Wide Shut'))));
dir_fname | dir_lname ----------------------+---------------------- Stanley | Kubrick (1 row)
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a query in SQL to list all the information of the actors who played a role in the movie 'Annie Hall'.
Next: Write a query in SQL to list all the movies which released in the country other than UK.
What is the difficulty level of this exercise?