Getting started with cypher


Cypher is a declarative graph query language that allows for expressive and efficient querying and updating of a property graph.

Cypher was originally created by Neo Technology for its graph database Neo4j, but was opened up through the openCypher project in October 2015 and has since been adopted by several other graph database vendors, including SAP HANA and AgensGraph.



Keyword Guide

Read Keywords

KeyWord Function Example
MATCH Find following expression in graph MATCH (n)

Write Keywords

KeyWord Function Example
CREATE Create the following pattern CREATE (n:Person{name:“Bob”})
DELETE Delete the following nodes/relationships DELETE n
DETACH DELETE Delete the following nodes, and any attached relationships DETACH DELETE n

Read-Write Keywords

KeyWord Function Example
Merge Match following pattern, or create it Merge (n:Person{id:1337})

Filter Keywords

KeyWord Function Example
Limit Limit result rows to the following number. Combine with Skip to page results Limit 25
Skip Skip first n result rows. Combine with Limit to page results Skip 25
WHERE Filter results by following expression WHERE n.age > 21
AND/OR And/Or multiple expressions WHERE n.age > 21 AND n.age < 30
NOT Negate following expression WHERE NOT n.age > 21
ANY/ALL/NONE/SINGLE Filter based on collection WHERE ALL (p in people

Remember to check the Refcard for your version of Cypher, as these may have changed.

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow