Comparison Condition
Conditions
Description
Comparison conditions state logical relationships between two values. All comparison conditions are binary operators with a Boolean return type.
Grammar Syntax
Redshift supports the comparison operators described in the following table:
<
a < b
Value a is less than value b.
>
a > b
Value a is greater than value b.
<=
a <= b
Value a is less than or equal to value b.
>=
a >= b
Value a is greater than or equal to value b.
=
a = b
Value a is equal to value b.
<> | !=
a <> b | a != b
Value a is not equal to value b.
ANY | SOME
a = ANY(subquery)
Value a is equal to any value returned by the subquery.
ALL
a <> ALL or != ALL (subquery)
Value a is not equal to any value returned by the subquery.
IS TRUE | FALSE | UNKNOWN
a IS TRUE
Value a is Boolean TRUE.
Use of comparison operators on Strings
It is important to note that in Redshift, comparison operators on strings ignore trailing blank spaces. To replicate this behavior in Snowflake, the transformation applies the RTRIM
function to remove trailing spaces, ensuring equivalent functionality. For more information: Significance of trailing blanks
Conversion Table
Most of the operators are directly supported by Snowflake; however, the following operators require transformation:
(expression) IS TRUE
expression
Condition is TRUE
.
(expression) IS FALSE
NOT (expression)
Condition is FALSE
.
(expression) IS UNKNOWN
expression IS NULL
Expression evaluates to NULL
(same as UNKNOWN
).
Sample Source Patterns
Input Code:
Output Code:
Known Issues
No issues were found.
Related EWIs
There are no known issues.
Last updated