Each of the simple comparison operators compares two operands and returns a boolean result. The two operands must belong to the same data type. If the operands are expressions then they must resolve to the same data type.
The following table shows the simple comparison operators:
| Operator: | Description: |
|---|---|
| exp1 > exp2 | Evaluates whether exp1 is greater than exp2. |
| exp1 < exp2 | Evaluates whether exp1 is less than exp2. |
| exp1 >=exp2 | Evaluates whether exp1 is greater than or equal to exp2. |
| exp1 <= exp2 | Evaluates whether exp1 is less than or equal to exp2. |
| exp1 = exp2 | Evaluates whether exp1 equals exp2. |
| exp1 <> exp2 | Evaluates whether exp1 is not equal to exp2. |
Currently the only supported complex comparison operators are IS NULL and IS NOT NULL.
Each of the logical operators evaluates one or two boolean operands and returns a boolean result. If the operands are expressions then they must resolve to boolean.
The following table shows the simple comparison operators:
| Operator: | Description: |
|---|---|
| NOT exp1 | Returns the logical negation of exp1 |
| exp1 AND exp2 | Returns the logical AND of exp1 and exp2 |
| exp1 OR exp2 | Returns the logical OR of exp1 and exp2. |
Each of the numeric operators evaluates one or two operands and returns a numeric result. The operands must belong to a numeric data type or be NULL. If either operand is NULL then the result is NULL. If the operands are of different numeric data types then special rules for implicit casting apply.
| Operator: | Description: |
|---|---|
| -exp1 | Negates exp1. |
| exp1 + exp2 | Returns the sum of exp1 and exp2 |
| exp1 - exp2 | Returns the value of exp1 minus exp2. |
| exp1 * exp2 | Returns the product or exp1 and exp2 |
| exp1 / exp2 | Returns the value of exp1 divided by exp2 |
A string operators evaluates two operands and returns a string result. The operands must belong to a string data type or be NULL. If either operand is NULL then the result is NULL.
| Operator: | Description: |
|---|---|
| exp1 || exp2 | Returns the value of exp2 concatenated to exp1 |
Operators at the same level are evaluated left to right.
To make your ESQL expressions easier to comprehend, it is a good practice to use parentheses to indicate explicitly which operands are to be evaluated together.