Snowflake supports most of the standard operators defined in SQL:1999.
Arithmetic Operators
+ , – , * , / , %
+ (unary) | +a | Returns a, which will cause implicit conversion of a to a numeric value. If a is a string, but the string cannot be converted to a numeric value, an error is returned. |
+ | a + b | Adds two numeric expressions (a and b). |
– (unary) | -a | Negates the input numeric expression. |
– | a – b | Subtracts one numeric expression (b) from another (a). |
– | a – b | Subtracts one date expression (b) from another (a). The result is an integer number of days. Subtraction is the only arithmetic operation allowed on DATE expressions. |
* | a * b | Multiplies two numeric expressions (a and b). |
/ | a / b | Divides one numeric expression (a) by another (b). |
% | a % b | Computes the modulo of numeric expression a per b. See also MOD. |
Comparison Operators
= , != , <> , < , <= , > , >=
= | a = b | a is equal to b. |
!= | a != b | a is not equal to b. |
<> | a <> b | a is not equal to b. |
> | a > b | a is greater than b. |
>= | a >= b | a is greater than or equal to b. |
< | a < b | a is less than b. |
<= | a <= b | a is less than or equal to b |
Logical/Boolean Operators
AND , NOT , OR
<span class="pre">AND</span> |
<span class="pre">a</span> <span class="pre">AND</span> <span class="pre">b</span> |
Matches both expressions (<em><span class="pre">a</span></em> and <em><span class="pre">b</span></em> ). |
<span class="pre">NOT</span> |
<span class="pre">NOT</span> <span class="pre">a</span> |
Does not match the expression. |
<span class="pre">OR</span> |
<span class="pre">a</span> <span class="pre">OR</span> <span class="pre">b</span> |
Matches either expression. |
Set Operators
INTERSECT, MINUS, EXCEPT, UNION
Subquery Operators
[NOT] EXISTS, ANY / ALL, [NOT] IN