cancel
Showing results for 
Search instead for 
Did you mean: 

Help on query

Hi All,
I am learning the Neo4j.

I am trying to run a query on Movie db
Q> get the name of movies given a person name.

can any one please help me.
thank you

2 REPLIES 2

glilienfield
Ninja
Ninja

If you mean actor when you say person, then the following will find the actors in the matrix movie:

MATCH (p:Person)-[:ACTED_IN]->(:Movie{title: 'The Matrix Reloaded'}) RETURN p.name

If you mean director when you say person, then the following will find the directors of the matrix movie

MATCH (p:Person)-[:DIRECTED]->(:Movie{title: 'The Matrix Reloaded'}) RETURN p.name

I suggest you go through the movie guide in Neo4j browser. It will explain some of these queries:

:guide movie-graph

glilienfield
Ninja
Ninja

Oops, I realized you wanted the movie given the person. Try these instead:

Movies Laurence Fishburne acted in:

MATCH (:Person{name: "Laurence Fishburne"})-[:ACTED_IN]->(m:Movie) RETURN m.title

Movies directed by Lilly Wachowski:

MATCH (:Person{name: "Lilly Wachowski"})-[:DIRECTED]->(m:Movie) RETURN m.title
Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.