Javatpoint Logo
Javatpoint Logo

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.

Neo4j Returns clause 1

Now RETURN a single node.

Output:

Neo4j Returns clause 2

Return Multiple Nodes

Syntax:

Example:

Let's return 2 nodes c and CT2013

Output:

Neo4j Returns clause 3

Return Relationships

Syntax:

Example:

See this example which creates two relationships and returns them.

Output:

Neo4j Returns clause 4

Return Properties

Syntax:

Example:

Let's return the properties of a node p.

Output:

Neo4j Returns clause 5

Return All Elements

Example:

Output:

Neo4j Returns clause 6





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA