Database management command syntax
Almost all administration commands have variations. The most common variations include parts of the commands that are optional, or that can have multiple values. Some variations are indicated using special characters. See Reading the administration commands syntax for details.
This page summarizes the various command syntax options. It also includes examples for both Cypher 5 and Cypher 25 when available.
Cypher® versions
The Cypher language has been decoupled from the Neo4j server versioning and now has its own versioning system. You can choose between Cypher 5 and Cypher 25:
-
Cypher 5 is the language version with which all queries written for Neo4j 2025.05 and earlier versions are compatible. It remains the default version for all newly created databases; however, as of Neo4j 2025.06, it is frozen and will only receive performance enhancements and bug fixes in future server releases.
-
Cypher 25 is the new version of the Cypher language. It builds upon Cypher 5 and includes new and improved features, as well as some removals. Any new Cypher features introduced in Neo4j 2025.06 or later will be added only to Cypher 25.
For more information about the Cypher versioning, see Cypher Manual → Select Cypher version.
You can specify the version of Cypher in which you want to run your queries (Cypher 5 or Cypher 25) by configuring a default Cypher version for the whole DBMS, for a database, or by setting it on a per-query basis. For details, see the Configure the Cypher default version.
Reading the administration commands syntax
Character | Meaning | Example |
---|---|---|
|
Used to indicate alternative parts of a command (i.e. |
If the syntax needs to specify either a name or |
|
Used to group parts of the command. Commonly found together with |
In order to use the |
|
Used to indicate an optional part of the command. It also groups alternatives together, when there can be either of the alternatives or nothing. |
If a keyword in the syntax can either be in singular or plural, we can indicate that the |
|
Repeated pattern. Related to the command part immediately before this is repeated. |
A comma separated list of names would be |
|
When a special character is part of the syntax itself, we surround it with |
To include |
The special characters in the table above are the only ones that need to be escaped using "
in the syntax summaries.
Here is an example that uses all the special characters.
It grants the READ
privilege:
GRANT READ
"{" { * | property[, ...] } "}"
ON {HOME GRAPH | GRAPH[S] { * | name[, ...] }}
[ ELEMENT[S] { * | label-or-rel-type[, ...] }
| NODE[S] { * | label[, ...] }
| RELATIONSHIP[S] { * | rel-type[, ...] }]
TO role[, ...]
Note that this command includes {
and }
in the syntax, and between them there can be a grouping of properties or the character *
.
It also has multiple optional parts, including the entity part of the command which is the grouping following the graph name.
For details about the graph privilege commands syntax, see Components of the graph privilege commands.
However, there is no need to escape any characters when creating a constraint for a node property.
This is because (
and )
are not special characters, and [
and ]
indicate that the constraint name and the IF NOT EXISTS
parts are optional, and therefore not part of the command.
CREATE CONSTRAINT [constraint_name] [IF NOT EXISTS]
FOR (n:LabelName)
REQUIRE n.propertyName IS NOT NULL
Database management command syntax
The database management commands are used to manage standard or composite databases.
Show databases
Command | Syntax |
---|---|
|
|
Create a database
Command | Syntax |
---|---|
|
|
|
Command | Syntax |
---|---|
|
|
|
Create a composite database
Command | Syntax |
---|---|
|
|
|
Command | Syntax |
---|---|
|
|
|
Alter a database
Command | Syntax |
---|---|
|
|
There can be multiple
|
Database alias management command syntax
The database alias management commands are used to manage local or remote database aliases.
Show aliases
Command | Syntax |
---|---|
|
Lists both local and remote database aliases, optionally filtered on the alias name. |
Create a local alias
Command | Syntax |
---|---|
|
|
Create a remote alias
Command | Syntax |
---|---|
|
|
|
Alter a local alias
Command | Syntax |
---|---|
|
|
Alter a remote alias
Command | Syntax |
---|---|
|
|
|