Cypher
The Cypher domain tests whether you can express graph reads and writes declaratively and predict exactly which rows come back. Questions range from pattern syntax and clause ordering to aggregation, subqueries, and the MERGE semantics that produce the most wrong answers.
Clauses are a pipeline
A Cypher query streams records through clauses. MATCH finds pattern matches, WHERE filters them, WITH projects and can aggregate or paginate between stages, and RETURN produces the result. Writing clauses - CREATE, MERGE, SET, REMOVE, DELETE, DETACH DELETE - continue that pipeline, so MATCH ... WITH ... CREATE ... RETURN is one valid statement.
Patterns and predicates
Node patterns bind variables and inline properties: (p:Person {name:'Ada'}). Relationship patterns carry type and direction: (a)-[:KNOWS]->(b). Omitting the arrow matches either direction. Variable-length patterns such as -[:KNOWS*1..3]-> return one row per path, multiplying rows when combined with other matches.
Worked example
Return every Person with no outgoing ACTED_IN relationship, ordered by name:
MATCH (p:Person)
WHERE NOT EXISTS { MATCH (p)-[:ACTED_IN]->() }
RETURN p.name AS name
ORDER BY name
Reasoning: the EXISTS subquery tests for a pattern without expanding it into rows, so each person appears once. The anonymous node () avoids binding a variable you never use. Writing OPTIONAL MATCH (p)-[:ACTED_IN]->(m) WHERE m IS NULL behaves differently: that WHERE is part of the optional match, so you need an intervening WITH p, m WHERE m IS NULL to filter afterwards.
Traps that cost marks
MERGE on a whole pattern creates every element when any part is missing - merge the anchor node first, then merge the relationship. Labels, relationship types, and property keys cannot be parameters; only values can. WHERE cannot follow RETURN. DETACH DELETE is required when a node still has relationships. Aggregation groups by every non-aggregated expression in the projection.
Reading plans
EXPLAIN shows the plan without running the query; PROFILE runs it and reports db hits per operator. Index lookups appear as NodeIndexSeek; a AllNodesScan usually means a missing label or index.