- 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 - NULL
Neo4j CQL treats null value as missing value or undefined value to properties of a Node or Relationship.
When we create a Node with existing Node label name without specifying its properties values, then it creates a new Node with NULL property values.
Let us examine this with an example.
Example
This example demonstrates how CREATE command sets NULL values to Undefined properties. How to retrieve all rows of a Node without NULL Rows.
Step 1 - Open Neo4j Data Browser
Step 2 - Type the below command at dollar prompt in Data Browser.
MATCH (e:Employee) RETURN e.id,e.name,e.sal,e.deptno
Step 3 - Click on Execute button and observe the results.
Here observe all Employee nodes does NOT contain NULL property values.
Step 4 - Type the below Command and click on Execute button
CREATE (e:Employee)
If we observe the above success message, it has not created any property to Employee node.
Step 5 - Type the below Command and click on Execute button
MATCH (e:Employee) RETURN e.id,e.name,e.sal,e.deptno)
If we observe these results, then the previous CREATE Command has inserted an Employee node by setting all its properties values to NULL
Step 6 - Type the below Command and click on Execute button
MATCH (e:Employee) WHERE e.id IS NOT NULL RETURN e.id,e.name,e.sal,e.deptno
If we observe these results, it does not return NULL values row because we have provided a WHERE clause to filter that row i.e. Id property should not contain NULL value.
WHEREIS NOT NULL
Here we are using IS NOT operator to filter NULL row.
Step 7 - Type the below Command and click on Execute button
MATCH (e:Employee) WHERE e.id IS NULL RETURN e.id,e.name,e.sal,e.deptno
If we observe these results, it returns only NULL values row because we have provided a WHERE clause to check ID value is NULL.
WHEREIS NULL
Here we are using IS operator to return only NULL row.