Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Delete Nodes and Relationships in Neo4J with Cypher

    Matt RossMatt Ross

    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.



    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson




    Instructor: 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.

    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.