CREATE statement is used to create relationship between nodes. These relationships define direction, type and form patterns of the data.
It defines mainly three things:
While creating a relationship, relationship should be specified within square braces "[ ]", depending on the direction of the relationship it is placed between hyphen " - " and arrow " ? " as shown in the following syntax.
Let's create two nodes "Raul" and "It" first and then specify the relationship between them.
Now create a relationship "PLAYER_OF between these two nodes as ?
You can also see it in tabular or text form:
You can also download (export) the graph in which format you want to save it. Click on the download button, see the example:
Create a Relationship between existing Nodes
MATCH statement is used to create relationship between the existing Nodes.
Create a relationship using MATCH statement.
Create a Relationship with Label and Properties
CREATE statement is used to create a relationship with label and properties.
Let's take an example to create a relationship for a node with label and properties using the CREATE statement.
First create a node "Kohli", having multiple labels
Then create some properties with the same node:
Create another node "Ind":
Now create a relationship with label and properties:
Creating a complete path
In Neo4j, CREATE statement is used to create a path. A path is formed using continuous relationship.
First create a node3 name "Champions_Trophy" to do further operations.
Now execute the following code: