Neo4j CQL - CREATE Label

Label is a name or identifier to a Node or a Relationship in Neo4j Database.
We can say this Label name to a Relationship as "Relationship Type".
We can use CQL CREATE command to create a single label to a Node or a Relationship and multiple labels to a Node. That means Neo4j supports only single Relationship Type between two nodes.
We can observe this Node's or Relationship's label name in CQL Data Browser in both UI Mode and Grid Mode. And also we refer it executing CQL Commands.
So far, we have created only one label to a Node or a Relationship, but we did not discuss about it's syntax much.
Neo4j CQL CREATE command is used 
To create a single label to a Node
To create a single label to a Node
To create multiple labels to a Node
To create multiple labels to a Node
To create a single label to a Relationship
To create a single label to a Relationship
We are going to discuss how to create a single label or multiple labels of a Node in this chapter. We will discuss how to create a single label to a Relationship in next chapter.
Syntax
CREATE (<node-name>:<label-name>)
NOTE -
We should use colon(:) operator to separate the node name and label name.
We should use colon(:) operator to separate the node name and label name.
Neo4j Database Server uses this name to store this node details in Database.As a Neo4j DBA or Developer, we cannot use it to access node details
Neo4j Database Server uses this name to store this node details in Database.As a Neo4j DBA or Developer, we cannot use it to access node details
Neo4j Database Server creates a label name as an alias to internal node name.As a Neo4j DBA or Developer, we should use this label name to access node details.
Neo4j Database Server creates a label name as an alias to internal node name.As a Neo4j DBA or Developer, we should use this label name to access node details.
This Example demonstrates how to create a Single label to  "GooglePlusProfile" node.
Step 1 - Open Neo4j Data Browser
Step 2 - Type the below command on Data Browser
CREATE (google1:GooglePlusProfile)
Here google1is a node name
GooglePlusProfileis a label name for google1node
Step 3 - Click on "Execute" button and observe the results.
We can observe that one label and one node is created in the Neo4j Database.
Syntax
CREATE (<node-name>:<label-name1>:<label-name2>.....:<label-namen>)
NOTE -
We should use colon(:) operator to separate the node name and label name.
We should use colon(:) operator to separate the node name and label name.
We should use colon(:) operator to separate one label name to another label name.
We should use colon(:) operator to separate one label name to another label name.
This Example demonstrates how to create multiple label names to  "Cinema" node.
Multiple Label names given by our Client: Cinema,Film,Movie,Picture
Step 1 - Open Neo4j Data Browser
Step 2 - Type the below command on Data Browser
CREATE (m:Movie:Cinema:Film:Picture)
Here m is a node name
Movie, Cinema, Film, Picture are multiple label names for m node
Step 3 - Click on "Execute" button and observe the results.
Here we can observe that four labels and one node is created in the Neo4j Database.
Syntax
CREATE (<node1-name>:<label1-name>)-
	[(<relationship-name>:<relationship-label-name>)]
	->(<node2-name>:<label2-name>)
NOTE -
We should use colon(:) operator to separate the node name and label name.
We should use colon(:) operator to separate the node name and label name.
We should use colon(:) operator to separate the relationship name and relationship label name.
We should use colon(:) operator to separate the relationship name and relationship label name.
We should use colon(:) operator to separate one label name to another label name.
We should use colon(:) operator to separate one label name to another label name.
Neo4J Database Server uses this name to store this node details in Database.As a Neo4J DBA or Developer, we cannot use it to access node details
Neo4J Database Server uses this name to store this node details in Database.As a Neo4J DBA or Developer, we cannot use it to access node details
Neo4J Database Server creates a label name as an alias to internal node name.As a Neo4J DBA or Developer, we should use this label name to access node details.
Neo4J Database Server creates a label name as an alias to internal node name.As a Neo4J DBA or Developer, we should use this label name to access node details.
This Example demonstrates how to create a Label to  a Relationship
Step 1 - Open Neo4J Data Browser
Step 2 - Type the below command on Data Browser
CREATE (p1:Profile1)-[r1:LIKES]->(p2:Profile2)
Here p1 and Profile1 are is node name and node label name of "From Node"
p2 and Profile2 are is node name and node label name of "To Node"
r1 is a relationship name
LIKES is a relationship label name
Step 1 - Click on "Execute" button and observe the results.
Here We can observe that two Nodes, two labels and one Relationship is added to the Neo4J Database.
 Print
 Add Notes
 Bookmark this page