Graph Database Flashcards

1
Q

What is Cypher?

A

Cypher is a query language designed for Neo4j graph databases, used to query and manipulate graph data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you find all friends of a person named Alice?

A

MATCH (n:Person {name:”Alice”})-[:FRIEND_OF]->(friend)
RETURN friend.name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you find friends of Alice’s friends?

A

MATCH (n:Person {name:”Alice”})-[:FRIEND_OF*2]->(friend)
RETURN friend.name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you count occurrences in a query?

A

MATCH (p1:Person)-[:INTERESTED_IN]->(i:Interest)<-[:INTERESTED_IN]-(p2:Person)
RETURN p1.name, p2.name, COUNT(*) as SharedInterests
ORDER BY SharedInterests DESC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly