Cypher — The Graph Query Language

With Neo4j, connections between data are stored – not computed at query time. Cypher is a powerful, graph-optimized query language that understands, and takes advantage of, these stored connections.

When trying to find patterns or insights within data, Cypher queries are often much simpler and easier to write than massive SQL JOINs. Since Neo4j doesn’t have tables, there are no JOINs to worry about. For comparison with SQL, here's a simple Cypher query matching all products in a category hierarchy:

Cypher

MATCH (p:Product)-[:CATEGORY]->(l:ProductCategory)-[:PARENT*0..]->(:ProductCategory {name:"Dairy Products"}) RETURN p.name

Here's a similar query in SQL, which is longer and more complex. Unlike Cypher, where depth is unlimited, this SQL query selects just three levels of depth.

SQL