Drop constraint | Drop constraint in neo4j - neo4j tutorial - graph database
What is DROP CONSTRAINT in neo4j?
- You can drop a constraint using the DROP CONSTRAINT statement.
- This will remove the constraint from the database, as well as its associated index.
- So, to drop our previously created constraint (and its associated index), we can use the following statement:
Neo4j drop constraints
- When the statement succeeds,the following message is displayed:
Relative Tags : neo , neo4j , graph database , neo4j cypher , neo4j python , neo4j tutorial , neo4j download , neograft
View the Schema
- You can now use the :schema command to verify that the applicable constraint (and its associated index) has been removed from the schema.
- Simply type this:
- You will see that the index is no longer in the schema:
- Neo4j CQL provides "DROP CONSTRAINT" command to delete existing Unique constraint from a node or relationship property.
Relative Tags : neo , neo4j , graph database , neo4j cypher , neo4j python , neo4j tutorial , neo4j download , neograft
Syntax
- Following is the syntax for dropping a UNIQUE constraint in Neo4j.
Example
- Following is a sample Cypher Query to remove the UNIQUE constraint on the property id.
- To execute the above query, carry out the following steps − Step 1 − Open the Neo4j desktop App and start the Neo4j Server. Open the built-in browser app of Neo4j using the URL http://localhost:7474/ as shown in the following screenshot.
- Step 2 − Copy and paste the desired query in the dollar prompt and press the play button (to execute the query) highlighted in the following screenshot.
Result
- On executing, you will get the following result.