Now for another challenge.
It looks like something strange has happened to the database.
It appears that Emil Eifrem, a founder of Neo4j, is in the database as an actor in a movie!
Which movie has Emil Eifrem acted in?
Update this Cypher query to only find movies that Emil Eifrem has acted in.
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
RETURN m.title
Select the title of the movie:
-
❏ The Birdcage
-
✓ The Matrix
-
❏ Cloud Atlas
-
❏ Hoffa
Hint
You will need to filter the query by the name
property of the (:Person)
node.
You can either filter the name of the Person node within the MATCH
clause or add a WHERE
clause to the query.
Solution
You can use the following query to find the title of the Movie that Emil is listed as acted in.
MATCH (p:Person {name: "Emil Eifrem"})-[:ACTED_IN]->(m:Movie)
RETURN m.title
The answer is The Matrix.
Summary
In this challenge, you demonstrated more skills in traversing the graph and filtering the results.
In the next lesson, you will learn some more ways that you can filter your queries.