117
Neo4j – Return Clause
In Neo4j, RETURN clause is used to return nodes, relationships and properties. By using RETURN clause, you get the following things:
- Return a single node.
- Return multiple nodes.
- Return relationships.
- Return properties.
- Return all elements.
Return a single Node
Syntax:
Example:
First create some nodes and relationships before proceeding for the example.
This will create 3 nodes and 2 relationships.
Now RETURN a single node.
Output:
Return Multiple Nodes
Syntax:
Example:
Let’s return 2 nodes c and CT2013
Output:
Return Relationships
Syntax:
Example:
See this example which creates two relationships and returns them.
Output:
Return Properties
Syntax:
Example:
Let’s return the properties of a node p.
Output:
Return All Elements
Example:
Output:
Next TopicNeo4j Order By Clause