October 2017
Beginner to intermediate
316 pages
8h
English
The first rule when deleting a node is that it is not connected to other nodes anymore. Just like the other operations, it is a matter of matching before deleting a node.
Should we want to DELETE Mr. Montague, the query would be as follows:
MATCH (r:Person{lastName:"Montague"})DELETE r;
However, this will fail with an error because of the LOVES relation.
So we either delete the relation first, or we use DETACH DELETE:
MATCH (r:Person{lastName:"Montague"}DETACH DELETE r;
Now, Juliet is alone.
We have now covered a solid base of Cypher. We will see more throughout the next chapters, while the next paragraph will be useful as a reference to this basis.
Read now
Unlock full access