Skip to content

Basic Cypher Queries

/assets/images/2021-12-19-15-07-33.png

Good Resources

Create Database

ENTERPRISE ONLY FEATURE

List nodes's in database

// Just nodes
MATCH (n) RETURN n;


// Nodes that have a relationship to another node
Match (n)-[r]->(m)
Return n,r,m;

// Match A Specific node label

// Match A Specific relationship

// Match A Specific property on a node

// Match a Specific property on a relationship

// Nodes that have a specific label

// Relationships that have a specific property

View Schema

CALL db.schema.visualization()

ChatGPT

Delete everything in database

MATCH (n)
DETACH DELETE n

Input some basic data

//data stored with this direction

// Node, Label, Relationship Property

// Create a node with a 
CREATE (p:Person)-[:LIKES]->(t:Technology)
CREATE (ee:Person {name: 'Emil', from: 'Sweden', kloutScore: 99})

Matching

//query relationship backwards will not return results
MATCH (p:Person)<-[:LIKES]-(t:Technology)

//better to query with undirected relationship unless sure of direction
MATCH (p:Person)-[:LIKES]-(t:Technology)