cancel
Showing results for 
Search instead for 
Did you mean: 

Using WHERE to Filter Queries Question 3 Answers

bahubba89
Node

In the Neo4j training course " Querying with Cypher in Neo4j 4.x, " Question 3 in the "Check Your Understanding" section asks "We want a query that returns the names of any people who both acted in and wrote the same movie. What query will retrieve this data?"

The only answer it takes as correct is MATCH (p:Person)-[:ACTED_IN]→(m:Movie) WHERE (p)-[:WROTE]-(m) RETURN p.name, m.title

However, the last answer also seems to work, and I tested it to confirm: MATCH (p:Person)-[:ACTED_IN]→(m:Movie)←[WROTE]-(p) RETURN p.name, m.title

Is there a reason that the second answer is not acceptable other than that it's just in the WHERE clause section of the course?

1 ACCEPTED SOLUTION

The second pattern uses [WROTE] which is not a relationship specifier, but a reference to a node. And it is not the correct answer.

These 2 queries do not return the same results.

Elaine

View solution in original post

2 REPLIES 2

sameer_gijare14
Graph Buddy

The only difference between the two queries is first one uses filters and the second one does not.The data set second query uses is analytical data that might have been prefiltered before ingesting into DB.
Thanks
Mr Sameer S G

The second pattern uses [WROTE] which is not a relationship specifier, but a reference to a node. And it is not the correct answer.

These 2 queries do not return the same results.

Elaine

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.