Introduction to Neo4j and
Cypher Query Language
(CQL)
Explore Neo4j, a leading graph database, and its query language, CQL.
What is Neo4j?
Definition
Native graph database for connected data
Purpose
Ideal for relationships and networks
Key Feature
Uses nodes and relationships to represent data
Why Neo4j?
Fast querying of complex relationships
Graph Database Basics
Nodes Relationships Properties Advantage
Entities like Person or Connections like Key-value pairs for nodes Intuitive for
Product FRIEND_OF or and relationships interconnected data
PURCHASED
Why Choose Neo4j?
Performance Scalability
Optimized for relationship traversal Handles billions of nodes and relationships
Flexibility Use Cases
Schema-free, dynamic data modeling Social networks, recommendations, knowledge graphs
Introduction to Cypher (CQL)
What is CQL?
Neo4j’s graph query language
Purpose
Simplifies querying and manipulating graphs
Syntax
Declarative, inspired by SQL
Key Feature
ASCII-art graph pattern representation
Cypher Syntax Basics
Nodes Relationships Basic Query Commands
(n:Label {property: value}) -[r:RELATION_TYPE]-> MATCH (p:Person {name: CREATE, MATCH, SET,
"Alice"})-[r:FRIEND_OF]- DELETE, MERGE
>(f) RETURN p, f;
Example Cypher Query
Scenario
Find friends of "Alice"
Query
MATCH (p:Person {name: "Alice"})-[r:FRIEND_OF]-
>(friend:Person) RETURN friend.name
Explanation
MATCH finds pattern, RETURN outputs friend names
Neo4j in Action & Getting Started
Applications Tools & Integration
• Social networks like LinkedIn • Neo4j Browser and Desktop
• Recommendation engines like Amazon • APIs for Python, Java, JavaScript
• Fraud detection in banking • Neo4j Sandbox for practice