Operators
Contents
For the tables below:
numberis any of the numer types:FLOAT,DOUBLE PRECISION, etc.textis any of the character types:CHARACTER VARYING,CHARACTER, etc.anyis any data type.
Binary Operations
Operator |
Precedence |
Name |
|---|---|---|
|
2 |
Multiplication |
|
2 |
Division |
|
3 |
Addition |
|
3 |
Subtraction |
|
3 |
Concatenation |
|
4 |
Equal |
|
4 |
Not equal |
|
4 |
Greater than |
|
4 |
Greater than |
|
4 |
Less than |
|
4 |
Less than |
|
4 |
Greater than or equal |
|
4 |
Greater than or equal |
|
4 |
Less than or equal |
|
4 |
Less than or equal |
|
6 |
Logical and |
|
7 |
Logical or |
The Precedence dictates the order of operations. For example 2 + 3 * 5 is
evaluated as 2 + (3 * 5) because * has a lower precedence so it happens
first. You can control the order of operations with parenthesis, like
(2 + 3) * 5.
Dividing by zero will result in SQLSTATE 22012 error.
Unary Operations
Operator |
Name |
|---|---|
|
Noop |
|
Unary negate |
|
Logical negate |
|
NULL check |
|
Not NULL check |