The where
clause will work the way it is supposed to. Just about all comparisons to NULL
return NULL
, which is treated as "false" in the where
clause.
So, all these expressions will return no rows if the value is NULL
:
WHERE table.field > 0
WHERE table.field = 0
WHERE table.field < 0
WHERE table.field <> 0
If you are concerned about NULL
values, test for them explicitly (using is null
or is not null
) or use a function like coalesce()
to give the field a value when it is NULL
.