Let's say you have a database that satisfies the following scheme:
(person {name:string, budget:int})
(person)-[:FRIEND]-(person)
How would one query the following in Cypher?
"Give all friends of Alice of whom holds that ALL their friends have a budget that is greater than 100."
You can use the following query in Cypher for this:
MATCH (alice {name:"Alice"})
MATCH (alice)-[:FRIEND]-(f)
MATCH (f)-[:FRIEND]-(person)
WITH f, collect(person) as friends
WHERE ALL(x in friends WHERE x.budget > 100 )
RETURN f, friends
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With