Deleting Emil

Emil Eifrem is not really an actor! We no longer want him in the database.

You task is to write the code to delete his node in the graph.

You can see the node by running the following code:

cypher
MATCH (e:Person {name: "Emil Eifrem"})-[]->(n)
RETURN e, n

Note that the node has relationships to other nodes in the graph. The relationships will also need to be deleted.

Validate Results

Once you have run the query, click the Check Database button and we will check the database for you.

Hint

First retrieve the node for Emil Eifrem.

As the node has relationships, you can use the DETACH DELETE clause to remove the node and any relationships.

Solution

The following query will find any :Person node with the name Emil Eifrem and then use the DETACH DELETE clause to remove each node and any relationships into our out from the node.

cypher
MATCH (p:Person {name: "Emil Eifrem"})
DETACH DELETE p

Summary

In this challenge, you demonstrated that you can delete a node from the graph.