Finding Specific Actors

Now for a challenge.

You will use what you have learned in this module to find people born after a specific year, who acted in a specific movie.

What actors in the movie As Good as It Gets were born after 1960?

Complete the WHERE clause in this query to filter for the movie title As Good as It Gets and for actors born after 1960.

cypher
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE 
RETURN p.name

Select all the actors born after 1960:

  • ❏ Jack Nicholson

  • ✓ Helen Hunt

  • ✓ Greg Kinnear

  • ✓ Cuba Gooding Jr.

Hint

Add a WHERE clause to test that the movie title property is equal to As Good as It Gets and a person’s born property is greater than 1960.

Solution

You can run the following query to find the answer:

cypher
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE m.title = 'As Good as It Gets' AND p.born > 1960
RETURN p.name

The actors born after 1960 are Helen Hunt, Greg Kinnear, and Cuba Gooding Jr.

Summary

In this challenge, you demonstrated your skills in filtering a query. In the next module, you will learn how to add data to the graph.