I don't like not knowing this as there may be situations when I need to use one instead of the other. It seems in most cases they produce the same results but I am taking a guess they have subtle difference, maybe to do with NULL values or one does strict comparisons like the extra = in PHP does.
Thanks
From the manual:
Note: The != operator is converted to <> in the parser stage. It is not possible to implement != and <> operators that do different things.
So no, there is no difference between the two.
<>
is the standard SQL operator meaning "not equal". Many databases, including postgresql, supports !=
as a synonym for <>
.
They're exactly the same in postgresql. See also the documentation.
Note though, that postgresql allows you to implement your own types and
overload operators for those types, so ultimately it depends on the datatypes involved what the !=
and <>
operator actually does, but <>
and !=
can never do different things.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With