List:General Discussion« Previous MessageNext Message »
From:Johan De Meersman Date:March 9 2012 9:36pm
Subject:Re: query problem with null
View as plain text  
----- Original Message -----
> From: "David Lerer" <DLerer@stripped>
> 
> Have you tried to set city = null   (i.e. without the quotes)?

Spot on, I'd think.

NULL values are not a string with "NULL" in it - that's only what it looks like in query
results :-) An empty string ('') is to strings what 0 (zero) is for integers: it says "the
value of this field is nothing". NULL, on the other hand, means "the value of this field
is a total unknown", which is useful, for example, in a field 'quantity': zero is still a
valid, meaningful quantity; whereas you would use NULL to indicate that you simply do not
know the quantity.

It's a bit of a peculiar concept, but as David indicated, IS NULL will not match fields
set to the string "NULL" - as that is a string, not an unknown.

Another funny attribute of NULL is that NULL != NULL. There simply *is* nothing to
compare, so you cannot ever say it's equal.


-- 
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel
Thread
query problem with nullRichard Reina9 Mar
  • RE: query problem with nullDavid Lerer9 Mar
    • Re: query problem with nullRichard Reina9 Mar
    • Re: query problem with nullJohan De Meersman9 Mar