Operator precedence
Operators in an expression are evaluated left-to-right in the order of their precedence. The following table lists the operators and their precedence:
Operator | Meaning | Order of precedence |
Unary +, Unary - | Arithmetic Identity, Arithmetic Negation | 1 |
*, / | Multiplication, Division | 2 |
Binary +, Binary -, || | Addition, Subtraction, Concatenation | 3 |
=, <, <=, >, >=, ^=,!=, <>,~=, IS NULL | Comparison | 4 |
NOT | Logical Negation | 5 |
AND | Logical Conjunction | 6 |
OR | Logical Disjunction | 7 |
To alter the order of evaluation, use parentheses. The most deeply nested expressions in parentheses are evaluated first, then operator precedence is used, and, finally, left-to-right order.