Delete Nodes and Relationships in Neo4J with Cypher

Matt Ross
InstructorMatt Ross

Share this video with your friends

Send Tweet
Published 4 years ago
Updated 2 years ago

Nothing lives forever, so we need to know how to use DELETE and DETACH to get rid of nodes and relationships we no longer want in our graph.

Instructor: [00:01] Removing nodes from Cypher is as simple as using MATCH to find the node and DELETE to remove it. If we're trying to delete a node with relationships however, we will need to instruct Neo4j to first detach that node's relationships and then delete the node. This will detach and delete all incoming and outgoing relationships for the node in question.

[00:23] We can also use DELETE to remove relationships connecting the nodes in our graph. We can see that Han is no longer related to Chewie through the "Has sidekick" relationship.