Neo4j Delete Clause

DELETE clause is used to delete a node or a relationship in a Neo4j database.

DELETE all Nodes and Relationships

Use the following query to delete all the nodes and the relationships in the database:

Example:

Output:

Neo4j Delete clauses 1

Delete a particular Node

If you want to delete a specific node then you have to specify the details of the node in the place of "n" in the above query.

Syntax:

Example:

First create a node "Dravid" in the Neo4j database as following:

Output:

Neo4j Delete clauses 2

Now delete the above created node using the DELETE clause.

Output:

Neo4j Delete clauses 3




Latest Courses