Note_Tech

All technological notes.


Project maintained by simonangel-fong Hosted on GitHub Pages — Theme by mattgraham

Cypher - Delete Command

Back


Delete a Node

// Delete a Node
MATCH (Kohli:person {Name: "Virat Kohli"})
DELETE Kohli

// Delete Multiple Nodes
MATCH (a:Student {Name: "Chris Grey"}), (b:Employee {Name: "Mark Twin"})
DELETE a,b

Delete a Relationship

// Delete a Relationship
MATCH (Raul)-[r:PLAYER_OF]->(It)
DELETE r

// delete a node and all relationships related to that node
MATCH (Kohli:player{name: "Virat Kohli"})
DETACH DELETE Kohli

DELETE all Nodes and Relationships

// Delete All Nodes
MATCH (n) DELETE n
// The above statement cannot delete nodes if they have any relationships.
// In other words, you must delete any relationships before you delete the node itself.

// Detach and delete all nodes
MATCH (Kohli:player{name: "Virat Kohli"})
DETACH DELETE Kohli

Delete All Database

// delete all database
DETACH DELETE;

TOP