- 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 - Retrieve Relationship Node's Details
We can use MATCH + RETURN command to view details of Nodes either which are created separately or created as part of a Relationship.
In this Chapter, we will discuss how to retrieve Node's details which are participating in a Relationship.
Syntax
MATCH (<node1-label-name>)-[<relationship-label-name>:<relationship-name>]->(<node2-label-name>) RETURN <relationship-label-name>
Syntax Description
S.No. | Syntax Element | Description |
---|---|---|
1. | MATCH,RETURN | They are Neo4j CQL keywords. |
2. | <node1-label-name> | It is a label name of "From Node" used to create a Relationship. |
3. | <node2-label-name> | It is a label name of "To Node" used to create a Relationship. |
4. | <relationship-name> | It is a name of a Relationship. |
5. | <relationship-label-name> | It is a label name of a Relationship. |
Example
This example demonstrates how to Retrieve the "Form Node" and "To Node" Node's details which are used in creating a Relationship.
Step 1 - Open Neo4j Data Browser
Step 2 - Type the below command on Data Browser
MATCH (cust)-[r:DO_SHOPPING_WITH]->(cc) RETURN cust,cc
Step 3 - Click on Execute button and view the results in Grid format by clicking Grid View button.
Here we can observe that two Node details which are participating in a Relationship. Also see the results in UI view
Advertisements
To Continue Learning Please Login
Login with Google