What is Cypher and how does it differ from SQL?

Beginner

Answer

Cypher is Neo4j's declarative query language designed specifically for working with graph data. Key differences from SQL:
Cypher characteristics:

  • Uses ASCII art to represent graph patterns: (a)-[:REL]->(b)
  • Focuses on pattern matching rather than table joins
  • More intuitive for expressing graph traversals
  • Supports path expressions naturally
    Example comparison:
// Cypher: Find friends of friends
MATCH (me:Person {name: "Alice"})-[:FRIEND]-(friend)-[:FRIEND]-(fof)
RETURN fof.name
// SQL equivalent would require multiple JOINs and be more complex