Expression Precedence
Expression Precedence
Precedence of operations from highest to lowest is:
- (), ?, Constant (including sign), NULL, ColumnReference, ScalarSubquery, CAST
- LENGTH, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, and other built-ins
- unary + and -
- *, /, || (concatenation)
- binary + and -
- comparisons, Quantified comparisons, EXISTS, IN, IS NULL, LIKE, BETWEEN, IS
- NOT
- AND
- OR
You can explicitly specify precedence by placing expressions within parentheses. An expression within parentheses is evaluated before any operations outside the parentheses are applied to it.