OceanBase AI Database currently supports arithmetic operators, bitwise operators, comparison operators, logical operators, date and time operators, character concatenation operators, and collation operators.
Operator precedence overview
The precedence of operators from highest to lowest is as follows. Operators on the same line have the same precedence.
COLLATE
!
- unary minus operator (-), ~ (one's complement operator)
^
*, /, DIV, %, MOD
-, +
<<, >>
&
|
= (comparison), <=>, >=, >, <=, <, <>, !=, IN
BETWEEN,
NOT
AND, &&
XOR
OR, ||
= (assignment), :=
Description
The priority 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 priority as<=>,>=,>,<=,<,<>, and!=. When used as an assignment operator, it has the same priority as:=.If operators with the same precedence appear in an expression, they are evaluated from left to right. However, assignment operations are evaluated from right to left.
The precedence and meaning of the following operators depend on the SQL mode:
By default,
||is a logicalORoperator. WhenPIPES_AS_CONCATis enabled,||performs string concatenation and has a precedence between^and unary operators.By default,
!has a higher precedence thanNOT. AfterHIGH_NOT_PRECEDENCEis enabled,!andNOThave the same precedence.