Open In App

Neo4j Create Constraint

The neo4j constraint helps user to nor enter in wrong kind of data. When the constraint is applied and the user by mistake entering the wrong kind of data then it will show an error message. In the neo4j there are two kind of constraint one is uniqueness constraints and other one is property existence constraints.
Below is the example of both the constraint with the example:
Suppose there is already below database is exist.

CREATE(CPP:Language{id:001, Designer: "Bjarne Stroustrup", YOE: 1985}) 
CREATE(C:Language {id:002, Designer: "Dennis Ritchie", YOE: 1972}) 
CREATE(Python:Language {id:003, Designer: "Guido van Rossum ", YOE: 1990}) 
CREATE(Java:Language {id:004, Designer: "James Gosling", YOE: 1995}) 
CREATE(CSharp:Language {id:005, Designer: "Microsoft", YOE: 2000})
RETURN CPP, C, Python, Java, CSharp 

Output:



Article Tags :