Neo4j MATCH Clause

Neo4j MATCH clause is used to retrieve all the nodes in the Neo4j database. It shows nodes as well as relationships between them.

Show Nodes

We have already created 6 nodes. Let's use the MATCH clause to see the nodes.

Output:

Neo4j Match function 1

The above command shows only nodes because there is no relationship between them.


Show Nodes and Relationships

Let's first create some nodes and relationships in the Neo4j database. Here we create 3 nodes and 2 relationships.

Neo4j Match function 2

Now use the MATCH clause with RETURN clause to see the nodes and relationship among them.

Output:

Neo4j Match function 3

This example shows the nodes and relationship both.





Latest Courses