Vertica Quick Tip: The <=> operator

Posted January 30, 2018 by Soniya Shah, Information Developer

Rear view of two partially unrecognizable men sitting in front of a computer. One of them is pointing at a screen where are several lines of computer code.
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!