When several operators are combined in a single expression, the operations are ordered according to the following table, from the lowest to the highest precedence level number. If the operators have equal precedence value, they are ordered from left to right. For example:
- If an expression contains both a sum and a comparison, the sum is executed before the comparison.
- If an expression contains both a multiplication and division operator, they are evaluated in the order that they appear in the expression, from left to right.
|1||()||Parentheses – grouping|
|1||IN||Inclusive OR list|
|3||+, –||Sign – unary plus/minus (-1)|
|4||*, /||Multiplication, division|
|6||+, –||Addition, subtraction|
|8||=, ==, <>, <, >, <=, >=||Comparison operators|
Contributors: Alberto Ferrari, Marco Russo, Jes Hansen