The standard arithmetic operators (addition, subtraction, multiplication, division, exponentiation, and modulo) use the standard precedence rules. That is, exponentiation runs first; multiplication, division, and modulo second; and addition and subtraction last. You can use parentheses to alter this precedence. IBM® Netezza® SQL evaluates operators of the same precedence in a left-to-right manner unless you use parentheses.
The following table describes the Netezza SQL operators.
| Operator | Symbol |
|---|---|
| Binary arithmetic operators | |
| Addition | + |
| Subtraction | - |
| Multiplication | * |
| Division | / |
| Exponentiation | ^ or ** |
| Modulo | % |
| Unary arithmetic operators | |
| Plus | + |
| Minus | - |
| Factorial | ! |
| Binary text operator | |
| Concatenate | || |
| Relational operators | |
| Equal | = |
| Not equal | <> or != |
| Greater than | > |
| Greater than or equal | >= |
| Less than | < |
| Less than or equal | <= |
| Operator/Element | Associativity | Description |
|---|---|---|
| . | Left | Table/column name separator |
| :: | Left | Typecast (PostgreSQL extension to standard SQL) |
| - | Right | Unary minus |
| ^ | Left | Exponentiation |
| * / % | Left | Multiplication, division, modulo |
| + – | Left | Addition, subtraction |
| IS | IS TRUE, IS FALSE, IS UNKNOWN, IS NULL, IS NOT NULL | |
| ISNULL | Test for null (PostgreSQL extension to standard SQL) | |
| NOTNULL | Test for not null (PostgreSQL extension to standard SQL.) | |
| (any other) | Left | All other native operators |
| IN | Set membership | |
| BETWEEN | Containment | |
| OVERLAPS | Time interval overlap | |
| LIKE | String pattern matching | |
| < <= > >= | Less than, less than or equal to, greater than, greater than or equal to | |
| = | Right | Equality, assignment |
| NOT | Right | Logical negation |
| AND | Left | Logical conjunction |
| OR | Left | Logical disjunction |