⚠️ This lesson is retired and might contain outdated information.

Create Nodes and Relationships in Neo4J with Cypher

Matt Ross
InstructorMatt Ross
Share this video with your friends

Social Share Links

Send Tweet

There are different types of data in Neo4J: Nodes and Relationships. We will cover the ways to create each type of data: creating nodes with properties, creating nodes with relationships, and creating constraints on nodes and relationships.

Instructor: [00:00] The most basic CREATE command has the following structure. CREATE followed by a variable name and a label in parentheses, separated by a colon. We can also assign multiple labels to a node.

[00:13] This will create a node with the label "Character" in our graph. If we want to do something a little more useful, we can set key value pairs when creating the node. We can also set these properties by using the SET clause and referencing the variable Leia.

[00:34] The CREATE statement can also be used to create data other than nodes. We can, for instance, create nodes with relationships between them and optionally, create properties on those relationships.

[00:47] We can also create a constraint on our graph, asserting that only one node with a certain property value can exist. We can do similar things with relationships. Here, we will say that a particular property must exist on all relationships of a given type. Similarly, we can drop any constraints we may have created.