The mathematical operators are `+`

, `-`

, `*`

, `/`

and `%`

, `^`

.

The comparison operators are `=`

, `<>`

, `<`

, `>`

, `<=`

, `>=`

, `IS NULL`

, and `IS NOT NULL`

.
See Section 3.2.5.7, “Equality and Comparison of Values” on how they behave.

The operators `STARTS WITH`

, `ENDS WITH`

and `CONTAINS`

can be used to search for a string value by its content.

The boolean operators are `AND`

, `OR`

, `XOR`

, `NOT`

.

Strings can be concatenated using the `+`

operator.
For regular expression matching the `=~`

operator is used.

Lists can be concatenated using the `+`

operator.
To check if an element exists in a list, you can use the `IN`

operator.

Since version 2.0, the previously existing property operators |

Cypher supports comparing values (see Section 3.2.1, “Values”) by equality using the `=`

and `<>`

operators.

Values of the same type are only equal if they are the same identical value (e.g. `3 = 3`

and `"x" <> "xy"`

).

Maps are only equal if they map exactly the same keys to equal values and lists are only equal if they contain the same sequence
of equal values (e.g. `[3, 4] = [1+2, 8/2]`

).

Values of different types are considered as equal according to the following rules:

- Paths are treated as lists of alternating nodes and relationships and are equal to all lists that contain that very same sequence of nodes and relationships.
- Testing any value against
`null`

with both the`=`

and the`<>`

operators always is`null`

. This includes`null = null`

and`null <> null`

. The only way to reliably test if a value`v`

is`null`

is by using the special`v IS NULL`

, or`v IS NOT NULL`

equality operators.

All other combinations of types of values cannot be compared with each other. Especially, nodes, relationships, and literal maps are incomparable with each other.

It is an error to compare values that cannot be compared.

The comparison operators `<=`

, `<`

(for ascending) and `>=`

, `>`

(for descending) are used to compare values for ordering.
The following points give some details on how the comparison is performed.

- Numerical values are compared for ordering using numerical order (e.g.
`3 < 4`

is true). - The special value
`java.lang.Double.NaN`

is regarded as being larger than all other numbers. - String values are compared for ordering using lexicographic order (e.g.
`"x" < "xy"`

). - Boolean values are compared for ordering such that
`false < true`

. - Comparing for ordering when one argument is
`null`

(e.g.`null < 3`

is`null`

). - It is an error to compare other types of values with each other for ordering.

Comparisons can be chained arbitrarily, e.g., `x < y <= z`

is equivalent to `x < y AND y <= z`

.

Formally, if `a, b, c, ..., y, z`

are expressions and `op1, op2, ..., opN`

are comparison operators, then `a op1 b op2 c ... y opN z`

is equivalent to `a op1 b and b op2 c and ... y opN z`

.

Note that `a op1 b op2 c`

does not imply any kind of comparison between `a`

and `c`

, so that, e.g., `x < y > z`

is perfectly legal (though perhaps not pretty).

The example:

`MATCH (n) WHERE 21 < n.age <= 30 RETURN n`

is equivalent to

`MATCH (n) WHERE 21 < n.age AND n.age <= 30 RETURN n`

Thus it will match all nodes where the age is between 21 and 30.

This syntax extends to all equality and inequality comparisons, as well as extending to chains longer than three.

For example:

`a < b = c <= d <> e`

Is equivalent to:

`a < b AND b = c AND c <= d AND d <> e`

For other comparison operators, see Section 3.2.5.2, “Comparison operators”.