Neo4J

Mukesh Kumar Published on 15 June 2021

Neo4j is a native graph database platform, built from the ground up to leverage not only data but also data relationships. Neo4j connects data as it’s stored, enabling queries never before imagined, at speeds never thought possible.


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




1

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

2

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.