Javatpoint Logo
Javatpoint Logo

Neo4j Create Constraints

In Neo4j, a constraint is used to place restrictions over the data that can be entered against a node or a relationship.

There are two types of constraints in Neo4j:

Uniqueness Constraint: It specifies that the property must contain a unique value. (For example: no two nodes with an player label can share a value for the Goals property.)

Property Existence Constraint: It makes ensure that a property exists for all nodes with a specific label or for all relationships with a specific type.

Create a Uniqueness Constraint

CREATE CONSTRAINT ON statement is used to create a uniqueness constraint in Neo4j.


Neo4j Create constraints 1


Use the :schema command to check the constraints.

Neo4j Create constraints 2

Property Existence Constraint

Property existence constraint is used to make ensure that all nodes with a certain label have a certain property.

Note: exists property constraint are only available in the Neo4j Enterprise Edition.

Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA