Skip to main content
Version: V1.4.0

Operator precedence

seekdb currently supports arithmetic operators, bitwise operators, comparison operators, logical operators, date and time operators, string concatenation operators, and collation operators.

Operator precedence overview​

The following table lists operators from highest to lowest precedence. Operators on the same line have the same precedence.

COLLATE
!
- (unary minus), ~ (bitwise NOT)
^
*, /, DIV, %, MOD
-, +
<<, >>
&
|
= (comparison), <=>, >=, >, <=, <, <>, !=
BETWEEN,
NOT
AND, &&
XOR
OR, ||
= (assignment), :=

Description​

  • The precedence of = depends on whether it is used as a comparison operator (=) or an assignment operator (=). When used as a comparison operator, it has the same precedence as <=>, >=, >, <=, <, <>, and !=. When used as an assignment operator, it has the same precedence as :=.

  • If multiple operators of the same precedence appear in an expression, they are evaluated from left to right, except for assignment operators, which are evaluated from right to left.

  • The precedence and meaning of the following operators depend on the SQL mode:

    • By default, || is the logical OR operator. When PIPES_AS_CONCAT is enabled, || is a string concatenation operator with precedence between ^ and unary operators.

    • By default, ! has higher precedence than NOT. When HIGH_NOT_PRECEDENCE is enabled, ! and NOT have the same precedence.