The <=> operator in Vertica

This blog post was authored by Jim Knicely.

The <=> operator performs an equality comparison like the = operator, but it returns true, instead of NULL, if both operands are NULL, and false, instead of NULL, if one operand is NULL.

Example:

dbadmin=> SELECT 1 = 2         "Returns FALSE",
dbadmin->        1 <=> 2       "Returns FALSE",
dbadmin->        1 <> NULL     "Returns NULL",
dbadmin->        1 <=> NULL    "Returns FALSE",
dbadmin->        NULL <=> NULL "Returns TRUE";
Returns FALSE | Returns FALSE | Returns NULL | Returns FALSE | Returns TRUE
---------------+---------------+--------------+---------------+--------------
f             | f             |              | f             | t
(1 row)

Have fun!

Sign In or Register to comment.