Skip to main content

Movie Character

Write a SQL Query to find the movie_title and name of director (first and last names combined) who directed a movie that casted a role as ‘SeanMaguire’.
Output Schema:
director_name,movie_title
NOTE:
  • Output column name has to match the given output schema.
  • Any name is the concatenation(without any delimiter) of first and last name if present
  • (E.g. if director_first_name is ‘Alfred’ and director_last_name is ‘Hitchcock’ then director_name is ‘AlfredHitchcock’)

Example Output:
director_name,movie_title
AlfredHitchcock,Vertigo
Solutions:

  1. select CONCAT(TRIM(directors.director_first_name), TRIM(directors.director_last_name))
  2. as director_name ,movie_title
  3. from (((directors inner join movies_directors
  4. on directors.director_id=movies_directors.director_id)inner join
  5. movies on movies.movie_id=movies_directors.movie_id)inner join
  6. movies_cast on movies.movie_id=movies_cast.movie_id) where
  7. movies_cast.role='SeanMaguire';


Thank You

Comments