- Neo4j Tutorial
- Neo4j - Home
- Neo4j - Overview
- Neo4j - Data Model
- Neo4j - Environment Setup
- Neo4j - Building Blocks
- Neo4j CQL Write Clauses
- Neo4j - Merge Command
- Neo4j - Set Clause
- Neo4j - Delete Clause
- Neo4j - Remove Clause
- Neo4j - Foreach Clause
- Neo4j CQL Read Clause
- Neo4j - Match Clause
- Neo4j - Optional Match Clause
- Neo4j - Where Clause
- Neo4j - Count Function
- Neo4j CQL General Clauses
- Neo4j - Return Clause
- Neo4j - Order By Clause
- Neo4j - Limit Clause
- Neo4j - Skip Clause
- Neo4j - With Clause
- Neo4j - Unwind Clause
- Neo4j CQL Functions
- Neo4j - String Functions
- Neo4j - Aggregation Function
- Neo4j CQL Admin
- Neo4j - Backup & Restore
- Neo4j - Index
- Neo4j - Create Unique Constraint
- Neo4j - Drop Unique
- Neo4j Useful Resources
- Neo4j - Quick Guide
- Neo4j - Useful Resources
- Neo4j - Discussion
Neo4j CQL - SET
Sometimes, based on our client requirements, we need to add new properties to existing Nodes or Relationships.
To do this, Neo4j CQL has provided a SET clause.
Neo4j CQL has provided SET clause to perform the following.
- Add new properties to existing Node or Relationship
- Add or Update Properties values
SET clause syntax
SET <property-name-list>
S.No. | Syntax Element | Description |
---|---|---|
1. | SET | It is a Neo4j CQL keyword. |
2. | <property-name-list> | It is a list of properties to perform add or update operation to fulfil our requirements. |
<property-name-list> syntax:
<node-label-name>.<property1-name>, <node-label-name>.<property2-name>, .... <node-label-name>.<propertyn-name>
Syntax Description
S.No. | Syntax Element | Description |
---|---|---|
1. | <node-label-name> | It is a label name of a Node. |
2. | <property-name> | It is a property name of a Node. |
NOTE -
We should use comma(,) operator to separate the property names list.
Example
This example demonstrates how to add a new property to existing DebitCard Node.
Step 1 - Open Neo4j Data Browser
Step 2 - Type the below command on Data Browser
MATCH (dc:DebitCard) RETURN dc
Step 3 - Click on "Execute" button and observe the results.
Here we can observe that "DebitCard" node has 5 properties. Now we are going to add new property "atm_pin" to this node.
Step 4 - Type the below command on Data Browser
MATCH (dc:DebitCard) SET dc.atm_pin = 3456 RETURN dc
Step 5 - Click on "Execute" button and observe the results.
Here we can observe new property is added to "DebitCard" node.