Re: So what's null then if it's not nothing?

From: Alexandr Savinov <spam_at_conceptoriented.com>
Date: Thu, 17 Nov 2005 16:03:34 +0100
Message-ID: <437c9bd6$1_at_news.fhg.de>


David Cressey schrieb:
> <michael_at_preece.net> wrote in message
> news:1132207394.336133.241390_at_g44g2000cwa.googlegroups.com...
>

>>I've been accustomed to thinking of things either having a value or
>>not. If something has no value then, to me, its value is null. Its
>>value is an empty string (whatever "it" is). Different to having a
>>value of zero. Different to anything with a value. Now, as I read up on
>>SQL, I find that null is supposed to mean "unknown". I can't easily
>>accept that. Does SQL's definition of null (unknown) include the null
>>I'm familiar with (no value)? That doesn't make sense. If we know
>>something has no value then its not an unknown value is it? I can't
>>imagine having to write code where the "if a=b then result=true else
>>result=false" construct won't work - according to what I'm reading, if
>>either a or b is null then I should be setting result to unknown
>>instead. Just can't get my head 'round that. Shouldn't things be a lot
>>simpler? If something has an unknown value then at least we know
>>whether it's null (as in an empty string) or not. To me, "unknown" can
>>be compared with an empty string to see if it's null or not. Sorry -
>>head is spinning.
>>
>>Mike.
>>

>
>
> It's no wonder your head is spinning. Even the experts disagree about the
> true meaning of NULL. Let's see if we can make some sense out of it.
>
> The best interpratation of NULL is "no value present", which is the same as
> your first interpretation.
>
> The problems begin with the inferences the reader draws from the absence of
> data in a certain place.
> Ultimately, in each case, it's a communications question between the writer
> of the row that contains the NULL
> and the reader that reads the NULL. The absence of data can mean whatever
> the two of them agree that it means.
>
> Like you, I have a problem with the assertion that NULL is like "unknown".
> "Unknown" asserts that a value exists, even though it is not known. I don't
> believe that every NULL asserts, or should assert, such a thing. Let's take
> a place (I would call it a field, but I don't want to draw fire from Joe
> Celko) where data might be missing, because there is no such data in the
> subject matter world.
>
> Let's take a cell whose meaning is: "Spouse's First Name". And let's
> imagine a context where such a cell might exist in connection with a single
> person. A NULL in such a cell does NOT mean unknown. The value isn't there
> because there is no such value. That doesn't mean "unknown".

Just to complete this example:

Unknown value should be used, for example, if the person would refuse to report who concretely is his spouse (or the name was forgotten). In this case he will be added to a list of married persons (because the spouse exists although unknown). In the case of null he will not be added to this list (he will be invisible).

> The theorists in c.d.t are going to come out in droves and try to teach me
> that, properly normalized, the circumstance I describe cannot occur. Save
> it, theorists. We've been there before. You're right, but you miss the
> point. Let's move on.

As I noticed in a parallel post the position that nulls can be and even should be avoided is simplistic. Nulls are a part of our world because they reflect the absence of things. We should not afraid of them. Our fears come from misunderstanding and inappropriate data modeling techniques and practices. (People tend to avoid what they do not understand and what they suffer from.) Nulls is a big head ache for data theorists and therefore they try to simply prohibit it.

-- 
http://conceptoriented.com
Received on Thu Nov 17 2005 - 16:03:34 CET

Original text of this message