Operation Precedence
The precedence of operations determines the order in which operations are performed within expressions. High precedence operations are performed before lower precedence operations.
Since parentheses have the highest precedence, operations within parentheses are always performed first.
Operations of the same precedence (for example A+B+C) are evaluated in left to right order, except for **, which is evaluated from right to left.
(Note that although an expression is evaluated from left to right, this does not mean that the operands are also evaluated from left to right. See Order of Evaluation for additional considerations.)
The following list indicates the precedence of operations from highest
to lowest:
- ()
- Built-in functions, user-defined functions
- unary +, unary -, NOT
- **
- *, /
- binary +, binary -
- =, <>, >, >=, <, <=, IN
- AND
- OR
Figure 1 shows how precedence works.