General:
(){} with comma-separated name = value pairs-[]->CREATE ({}) creates one node, CREATE ({}), ({}), ({}) creates three nodes, CREATE ({})-[]->({}) creates two nodes with a relationship connecting them, and so on. Bound variables can then be used to re-use a given node in multiple expressions.CREATE CONSTRAINT no_duplicate_cities FOR (p:Place) REQUIRE (p.country, p.city) IS NODE KEY means Place nodes need a unique composite key composed from a combination of city and country properties.Key verbs:
* CREATE: construct new instances of nodes, relationships, constraints
* DELETE: deconstruct a node, but will refuse if the node is linked via relationships; MATCH (n) DELETE n will delete any nodes but cleanly aborts if it leaves relationships dangling; MATCH ()-[r]->() DELETE r deletes any relationships (I think?)
* DETACH DELETE: delete nodes and any relationships attached; MATCH (n) DETACH DELETE n effectively empties the database
* MATCH: compare user-defined patterns to the underlying graph/datastore; MATCH (n) RETURN n is the "find all nodes and return them", like a SELECT * FROM * kind of super-query; MATCH ()-[r]->() matches any relationships (I think?)
* MERGE: a mix of MATCH and CREATE it will either match whole patterns or create new record that match the pattern in its entirety.
* RETURN: return the set of nodes to the query caller
* SET: add/update an attribute on a node/relationship
* REMOVE: remove an attribute on a node/relationship
Nodes can have zero-to-many labels
Last modified 02 November 2025