0PricingLogin
Neo4j Graph Database Fundamentals · Lesson

Updating and Deleting Graph Data

Learn to modify existing nodes and relationships using SET and REMOVE, and safely delete data with DELETE and DETACH DELETE.

Modifying Your Graph Data

In this lesson, you'll learn how to update and delete existing nodes and relationships in your Neo4j graph using Cypher. Modifying data is crucial for keeping your graph accurate and up-to-date.

We'll cover the essential clauses: SET for changing properties, REMOVE for taking properties or labels away, and DELETE / DETACH DELETE for removing graph elements entirely.

Update Node Properties with SET

The SET clause is used to modify existing properties on nodes or relationships, or to add new ones. Let's start by updating a node's property.

This example first creates a 'Person' node, then updates their age.

CREATE (p:Person {name: 'Alice', age: 30})
RETURN p

MATCH (p:Person {name: 'Alice'})
SET p.age = 31
RETURN p.name, p.age

All lessons in this course

  1. Filtering and Ordering Results
  2. Aggregation and Projections
  3. Updating and Deleting Graph Data
  4. Combining Queries with WITH and UNION
← Back to Neo4j Graph Database Fundamentals