Show constraints

To list all constraints with the default output columns, use SHOW CONSTRAINTS. If all columns are required, use SHOW CONSTRAINTS YIELD *. For the full command syntax to list constraints, see Syntax → Show constraints. The constraints listed on this page are created on the page Create constraints.

One of the output columns from SHOW CONSTRAINTS is the name of the constraint. This can be used to drop the constraint with the DROP CONSTRAINT command.

Listing constraints requires the SHOW CONSTRAINTS privilege.
Example 1. List all constraints with default output columns
Query
SHOW CONSTRAINTS
Result
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | name                    | type                              | entityType     | labelsOrTypes  | properties                   | ownedIndex              | propertyType                     |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 10 | "actor_fullname"        | "NODE_KEY"                        | "NODE"         | ["Actor"]      | ["firstname", "surname"]     | "actor_fullname"        | NULL                             |
| 20 | "author_name"           | "NODE_PROPERTY_EXISTENCE"         | "NODE"         | ["Author"]     | ["name"]                     | NULL                    | NULL                             |
| 63 | "book_isbn"             | "UNIQUENESS"                      | "NODE"         | ["Book"]       | ["isbn"]                     | "book_isbn"             | NULL                             |
| 3  | "book_title_year"       | "UNIQUENESS"                      | "NODE"         | ["Book"]       | ["title", "publicationYear"] | "book_title_year"       | NULL                             |
| 13 | "director_imdbId"       | "NODE_KEY"                        | "NODE"         | ["Director"]   | ["imdbId"]                   | "director_imdbId"       | NULL                             |
| 41 | "knows_since_how"       | "RELATIONSHIP_KEY"                | "RELATIONSHIP" | ["KNOWS"]      | ["since", "how"]             | "knows_since_how"       | NULL                             |
| 25 | "movie_tagline"         | "NODE_PROPERTY_TYPE"              | "NODE"         | ["Movie"]      | ["tagline"]                  | NULL                    | "STRING | LIST<STRING NOT NULL>" |
| 7  | "movie_title"           | "NODE_PROPERTY_TYPE"              | "NODE"         | ["Movie"]      | ["title"]                    | NULL                    | "STRING"                         |
| 28 | "node_uniqueness_param" | "UNIQUENESS"                      | "NODE"         | ["Book"]       | ["prop1"]                    | "node_uniqueness_param" | NULL                             |
| 38 | "ownershipId"           | "RELATIONSHIP_KEY"                | "RELATIONSHIP" | ["OWNS"]       | ["ownershipId"]              | "ownershipId"           | NULL                             |
| 44 | "part_of"               | "RELATIONSHIP_PROPERTY_TYPE"      | "RELATIONSHIP" | ["PART_OF"]    | ["order"]                    | NULL                    | "INTEGER"                        |
| 24 | "part_of_tags"          | "RELATIONSHIP_PROPERTY_TYPE"      | "RELATIONSHIP" | ["PART_OF"]    | ["tags"]                     | NULL                    | "STRING | LIST<STRING NOT NULL>" |
| 4  | "prequels"              | "RELATIONSHIP_UNIQUENESS"         | "RELATIONSHIP" | ["PREQUEL_OF"] | ["order", "author"]          | "prequels"              | NULL                             |
| 42 | "rel_exist_param"       | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"]      | ["published"]                | NULL                    | NULL                             |
| 65 | "sequels"               | "RELATIONSHIP_UNIQUENESS"         | "RELATIONSHIP" | ["SEQUEL_OF"]  | ["order"]                    | "sequels"               | NULL                             |
| 22 | "wrote_year"            | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"]      | ["year"]                     | NULL                    | NULL                             |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Example 2. List all constraints with full details

To return the full details of the constraints on a database, use SHOW CONSTRAINTS YIELD *

List all constraints with YIELD *
SHOW CONSTRAINTS YIELD *
Result
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | name                    | type                              | entityType     | labelsOrTypes  | properties                   | ownedIndex              | propertyType                     | options                                       | createStatement                                                                                                    |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 10 | "actor_fullname"        | "NODE_KEY"                        | "NODE"         | ["Actor"]      | ["firstname", "surname"]     | "actor_fullname"        | NULL                             | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `actor_fullname` FOR (n:`Actor`) REQUIRE (n.`firstname`, n.`surname`) IS NODE KEY"              |
| 20 | "author_name"           | "NODE_PROPERTY_EXISTENCE"         | "NODE"         | ["Author"]     | ["name"]                     | NULL                    | NULL                             | NULL                                          | "CREATE CONSTRAINT `author_name` FOR (n:`Author`) REQUIRE (n.`name`) IS NOT NULL"                                  |
| 63 | "book_isbn"             | "UNIQUENESS"                      | "NODE"         | ["Book"]       | ["isbn"]                     | "book_isbn"             | NULL                             | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `book_isbn` FOR (n:`Book`) REQUIRE (n.`isbn`) IS UNIQUE"                                        |
| 3  | "book_title_year"       | "UNIQUENESS"                      | "NODE"         | ["Book"]       | ["title", "publicationYear"] | "book_title_year"       | NULL                             | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `book_title_year` FOR (n:`Book`) REQUIRE (n.`title`, n.`publicationYear`) IS UNIQUE"            |
| 13 | "director_imdbId"       | "NODE_KEY"                        | "NODE"         | ["Director"]   | ["imdbId"]                   | "director_imdbId"       | NULL                             | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `director_imdbId` FOR (n:`Director`) REQUIRE (n.`imdbId`) IS NODE KEY"                          |
| 41 | "knows_since_how"       | "RELATIONSHIP_KEY"                | "RELATIONSHIP" | ["KNOWS"]      | ["since", "how"]             | "knows_since_how"       | NULL                             | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `knows_since_how` FOR ()-[r:`KNOWS`]-() REQUIRE (r.`since`, r.`how`) IS RELATIONSHIP KEY"       |
| 25 | "movie_tagline"         | "NODE_PROPERTY_TYPE"              | "NODE"         | ["Movie"]      | ["tagline"]                  | NULL                    | "STRING | LIST<STRING NOT NULL>" | NULL                                          | "CREATE CONSTRAINT `movie_tagline` FOR (n:`Movie`) REQUIRE (n.`tagline`) IS :: STRING | LIST<STRING NOT NULL>"     |
| 7  | "movie_title"           | "NODE_PROPERTY_TYPE"              | "NODE"         | ["Movie"]      | ["title"]                    | NULL                    | "STRING"                         | NULL                                          | "CREATE CONSTRAINT `movie_title` FOR (n:`Movie`) REQUIRE (n.`title`) IS :: STRING"                                 |
| 28 | "node_uniqueness_param" | "UNIQUENESS"                      | "NODE"         | ["Book"]       | ["prop1"]                    | "node_uniqueness_param" | NULL                             | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `node_uniqueness_param` FOR (n:`Book`) REQUIRE (n.`prop1`) IS UNIQUE"                           |
| 38 | "ownershipId"           | "RELATIONSHIP_KEY"                | "RELATIONSHIP" | ["OWNS"]       | ["ownershipId"]              | "ownershipId"           | NULL                             | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `ownershipId` FOR ()-[r:`OWNS`]-() REQUIRE (r.`ownershipId`) IS RELATIONSHIP KEY"               |
| 44 | "part_of"               | "RELATIONSHIP_PROPERTY_TYPE"      | "RELATIONSHIP" | ["PART_OF"]    | ["order"]                    | NULL                    | "INTEGER"                        | NULL                                          | "CREATE CONSTRAINT `part_of` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`order`) IS :: INTEGER"                            |
| 24 | "part_of_tags"          | "RELATIONSHIP_PROPERTY_TYPE"      | "RELATIONSHIP" | ["PART_OF"]    | ["tags"]                     | NULL                    | "STRING | LIST<STRING NOT NULL>" | NULL                                          | "CREATE CONSTRAINT `part_of_tags` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`tags`) IS :: STRING | LIST<STRING NOT NULL>" |
| 4  | "prequels"              | "RELATIONSHIP_UNIQUENESS"         | "RELATIONSHIP" | ["PREQUEL_OF"] | ["order", "author"]          | "prequels"              | NULL                             | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `prequels` FOR ()-[r:`PREQUEL_OF`]-() REQUIRE (r.`order`, r.`author`) IS UNIQUE"                |
| 42 | "rel_exist_param"       | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"]      | ["published"]                | NULL                    | NULL                             | NULL                                          | "CREATE CONSTRAINT `rel_exist_param` FOR ()-[r:`WROTE`]-() REQUIRE (r.`published`) IS NOT NULL"                    |
| 65 | "sequels"               | "RELATIONSHIP_UNIQUENESS"         | "RELATIONSHIP" | ["SEQUEL_OF"]  | ["order"]                    | "sequels"               | NULL                             | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `sequels` FOR ()-[r:`SEQUEL_OF`]-() REQUIRE (r.`order`) IS UNIQUE"                              |
| 22 | "wrote_year"            | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"]      | ["year"]                     | NULL                    | NULL                             | NULL                                          | "CREATE CONSTRAINT `wrote_year` FOR ()-[r:`WROTE`]-() REQUIRE (r.`year`) IS NOT NULL"                              |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
The type column returns UNIQUENESS for the node property uniqueness constraint and RELATIONSHIP_UNIQUENESS for the relationship property uniqueness constraint. This is updated in Cypher® 25. Node property uniqueness constraints are updated to NODE_PROPERTY_UNIQUENESS and relationship property uniqueness constraints to RELATIONSHIP_PROPERTY_UNIQUENESS.

Listing constraints with filtering

The SHOW CONSTRAINTS command can be filtered in various ways. The filtering of rows can be done using constraint type keywords or a WHERE clause, while filtering of columns is achieved by specifying the desired columns in a YIELD clause.

Example 3. List only specific constraint types
List only key constraints
SHOW KEY CONSTRAINTS
Result
+--------------------------------------------------------------------------------------------------------------------------------------------+
| id | name              | type               | entityType     | labelsOrTypes | properties               | ownedIndex        | propertyType |
+--------------------------------------------------------------------------------------------------------------------------------------------+
| 28 | "actor_fullname"  | "NODE_KEY"         | "NODE"         | ["Actor"]     | ["firstname", "surname"] | "actor_fullname"  | NULL         |
| 36 | "director_imdbId" | "NODE_KEY"         | "NODE"         | ["Director"]  | ["imdbId"]               | "director_imdbId" | NULL         |
| 26 | "knows_since_how" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["KNOWS"]     | ["since", "how"]         | "knows_since_how" | NULL         |
| 38 | "ownershipId"     | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["OWNS"]      | ["ownershipId"]          | "ownershipId"     | NULL         |
+--------------------------------------------------------------------------------------------------------------------------------------------+

For a full list of all the constraint types (and synonyms) available in this command see Syntax → SHOW CONSTRAINTS.

Example 4. Filtering constraints using the WHERE clause
List only constraints with a RELATIONSHIP entityType
SHOW CONSTRAINTS
WHERE entityType = 'RELATIONSHIP'
Result
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | name              | type                              | entityType     | labelsOrTypes  | properties          | ownedIndex        | propertyType                     |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 41 | "knows_since_how" | "RELATIONSHIP_KEY"                | "RELATIONSHIP" | ["KNOWS"]      | ["since", "how"]    | "knows_since_how" | NULL                             |
| 38 | "ownershipId"     | "RELATIONSHIP_KEY"                | "RELATIONSHIP" | ["OWNS"]       | ["ownershipId"]     | "ownershipId"     | NULL                             |
| 44 | "part_of"         | "RELATIONSHIP_PROPERTY_TYPE"      | "RELATIONSHIP" | ["PART_OF"]    | ["order"]           | NULL              | "INTEGER"                        |
| 24 | "part_of_tags"    | "RELATIONSHIP_PROPERTY_TYPE"      | "RELATIONSHIP" | ["PART_OF"]    | ["tags"]            | NULL              | "STRING | LIST<STRING NOT NULL>" |
| 4  | "prequels"        | "RELATIONSHIP_UNIQUENESS"         | "RELATIONSHIP" | ["PREQUEL_OF"] | ["order", "author"] | "prequels"        | NULL                             |
| 42 | "rel_exist_param" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"]      | ["published"]       | NULL              | NULL                             |
| 65 | "sequels"         | "RELATIONSHIP_UNIQUENESS"         | "RELATIONSHIP" | ["SEQUEL_OF"]  | ["order"]           | "sequels"         | NULL                             |
| 22 | "wrote_year"      | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"]      | ["year"]            | NULL              | NULL                             |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Example 5. Returning specific columns for all constraints

It is possible to return only specific columns of the available constraints using the YIELD clause:

List only the name, type, and createStatement columns
SHOW CONSTRAINTS
YIELD name, type, createStatement
Result
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| name                    | type                              | createStatement                                                                                                    |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| "actor_fullname"        | "NODE_KEY"                        | "CREATE CONSTRAINT `actor_fullname` FOR (n:`Actor`) REQUIRE (n.`firstname`, n.`surname`) IS NODE KEY"              |
| "author_name"           | "NODE_PROPERTY_EXISTENCE"         | "CREATE CONSTRAINT `author_name` FOR (n:`Author`) REQUIRE (n.`name`) IS NOT NULL"                                  |
| "book_isbn"             | "UNIQUENESS"                      | "CREATE CONSTRAINT `book_isbn` FOR (n:`Book`) REQUIRE (n.`isbn`) IS UNIQUE"                                        |
| "book_title_year"       | "UNIQUENESS"                      | "CREATE CONSTRAINT `book_title_year` FOR (n:`Book`) REQUIRE (n.`title`, n.`publicationYear`) IS UNIQUE"            |
| "director_imdbId"       | "NODE_KEY"                        | "CREATE CONSTRAINT `director_imdbId` FOR (n:`Director`) REQUIRE (n.`imdbId`) IS NODE KEY"                          |
| "knows_since_how"       | "RELATIONSHIP_KEY"                | "CREATE CONSTRAINT `knows_since_how` FOR ()-[r:`KNOWS`]-() REQUIRE (r.`since`, r.`how`) IS RELATIONSHIP KEY"       |
| "movie_tagline"         | "NODE_PROPERTY_TYPE"              | "CREATE CONSTRAINT `movie_tagline` FOR (n:`Movie`) REQUIRE (n.`tagline`) IS :: STRING | LIST<STRING NOT NULL>"     |
| "movie_title"           | "NODE_PROPERTY_TYPE"              | "CREATE CONSTRAINT `movie_title` FOR (n:`Movie`) REQUIRE (n.`title`) IS :: STRING"                                 |
| "node_uniqueness_param" | "UNIQUENESS"                      | "CREATE CONSTRAINT `node_uniqueness_param` FOR (n:`Book`) REQUIRE (n.`prop1`) IS UNIQUE"                           |
| "ownershipId"           | "RELATIONSHIP_KEY"                | "CREATE CONSTRAINT `ownershipId` FOR ()-[r:`OWNS`]-() REQUIRE (r.`ownershipId`) IS RELATIONSHIP KEY"               |
| "part_of"               | "RELATIONSHIP_PROPERTY_TYPE"      | "CREATE CONSTRAINT `part_of` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`order`) IS :: INTEGER"                            |
| "part_of_tags"          | "RELATIONSHIP_PROPERTY_TYPE"      | "CREATE CONSTRAINT `part_of_tags` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`tags`) IS :: STRING | LIST<STRING NOT NULL>" |
| "prequels"              | "RELATIONSHIP_UNIQUENESS"         | "CREATE CONSTRAINT `prequels` FOR ()-[r:`PREQUEL_OF`]-() REQUIRE (r.`order`, r.`author`) IS UNIQUE"                |
| "rel_exist_param"       | "RELATIONSHIP_PROPERTY_EXISTENCE" | "CREATE CONSTRAINT `rel_exist_param` FOR ()-[r:`WROTE`]-() REQUIRE (r.`published`) IS NOT NULL"                    |
| "sequels"               | "RELATIONSHIP_UNIQUENESS"         | "CREATE CONSTRAINT `sequels` FOR ()-[r:`SEQUEL_OF`]-() REQUIRE (r.`order`) IS UNIQUE"                              |
| "wrote_year"            | "RELATIONSHIP_PROPERTY_EXISTENCE" | "CREATE CONSTRAINT `wrote_year` FOR ()-[r:`WROTE`]-() REQUIRE (r.`year`) IS NOT NULL"                              |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Result columns for listing constraints

Listing constraints output
Column Description Type

id

The id of the constraint. Default Output

INTEGER

name

Name of the constraint (explicitly set by the user or automatically assigned). Default Output

STRING

type

The ConstraintType of this constraint (UNIQUENESS (node uniqueness), RELATIONSHIP_UNIQUENESS, NODE_PROPERTY_EXISTENCE, RELATIONSHIP_PROPERTY_EXISTENCE, NODE_PROPERTY_TYPE, RELATIONSHIP_PROPERTY_TYPE, NODE_LABEL_EXISTENCE, RELATIONSHIP_SOURCE_LABEL, RELATIONSHIP_TARGET_LABEL, NODE_KEY, or RELATIONSHIP_KEY). Default Output

UNIQUENESS and RELATIONSHIP_UNIQUENESS are updated to say NODE_PROPERTY_UNIQUENESS and RELATIONSHIP_PROPERTY_UNIQUENESS respectively in Cypher 25.

STRING

entityType

Type of entities this constraint represents (NODE or RELATIONSHIP). Default Output

STRING

labelsOrTypes

The labels or relationship types of this constraint. The list returned will only include a single value (the name of the constrained node label or relationship type). Default Output

LIST<STRING>

properties

The properties of this constraint, or null for node label existence, relationship source label, and relationship target constraints which do not constrain properties (these constraints are created as part of node and relationship element types when setting a graph type (only available in Cypher 25). For more information see the Cypher 25 Manual → Graph types). Default Output

LIST<STRING>

ownedIndex

The name of the index associated with the constraint or null, in case no index is associated with it. Default Output

STRING

propertyType

The property type the property is restricted to for property type constraints, or null for the other constraints. Default Output Introduced in 5.9

STRING

options

The options passed to CREATE command, for the index associated to the constraint, or null if no index is associated with the constraint.

MAP

createStatement

Statement used to create the constraint, or null if the constraint cannot be created through CREATE CONSTRAINT (for example in case of version incompatibilities or for constraints with dependent graph type classification). For more information on the dependent graph type classification, see the Cypher 25 Manual → Graph type elements in SHOW CONSTRAINTS.

STRING