- 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 - IN Operator
Like SQL, Neo4j CQL has provided an IN operator to give a collection of values to CQL Commands.
IN Operator syntax
IN[<Collection-of-values>]
Syntax Description
S.No. | Syntax Element | Description |
---|---|---|
1. | IN | It is a Neo4j CQL keyword. |
2. | [ | It tells Neo4j CQL that the start of a collection of values. |
3. | ] | It tells Neo4j CQL that the end of a collection of values. |
4. | <Collection-of-values> | It is a collection of values separated by comma operator. |
Let us examine this with an example.
Example
This example demonstrates how to use IN operator to retrieve Employee node details.
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.
We can observe that this query returns 4 rows.
Step 4 - Type the below command and click on Execute button.
MATCH (e:Employee) WHERE e.id IN [123,124] RETURN e.id,e.name,e.sal,e.deptno
This query returns only two rows whose ids are matched specified in the IN operator.
Advertisements