I'm working on code written by a previous developer and in a query it says,
WHERE p.name <=> NULL
What does <=>
mean in this query? Is it something equal to =
? Or is it a syntax error?
But it is not showing any errors or exceptions. I already know that <>
= !=
in MySQL.
<=>
is the NULL-safe equal operator.a <=> b
is same as writing:And sorry, I could not find one good reason to use this operator instead of
AND/OR IS (NOT) NULL
. Your example for example,WHERE p.name <=> NULL
is same asWHERE p.name IS NULL
.It is the NULL - Safe Equal to operator. Check description.