Dear Neo4j Community,
I just started to learn Neo4j and have some trouble understanding the logic behind two similar Cypher statements I used in exercise 4.10
The question in the exercise is:
Retrieve all people who have produced a movie, but have not directed a movie, returning their names and the movie titles.
My initial statement looked like this:
MATCH (a:Person)-[:PRODUCED]->(s:Movie)
WHERE NOT EXISTS ((a)-[:DIRECTED]->(s))
RETURN a.name, s.title
and returns 12 records
While the correct answer is displayed as:
MATCH (a:Person)-[:PRODUCED]->(s:Movie)
WHERE NOT EXISTS ((a)-[:DIRECTED]->(:Movie))
RETURN a.name, s.title
and returns 7 records.
The difference is that i initially used the "(s)" variable in pattern matching in line 2 instead of the "(:Movie)" label.
I tried to understand the difference and my assumption is, that my initial statement returns persons that produced a movie but did't direct the same movie, instead of returning person that produced a movie but didn't direct any movie.
Is this assumption correct?