Re: 3 value logic. Why is SQL so special?

From: Bob Badour <bbadour_at_pei.sympatico.ca>
Date: Sat, 09 Sep 2006 02:33:08 GMT
Message-ID: <EJpMg.15039$9u.165112_at_ursa-nb00s0.nbnet.nb.ca>


Evan Keel wrote:

> "Karen Hill" <karen_hill22_at_yahoo.com> wrote in message
> news:1157742315.903040.15430_at_b28g2000cwb.googlegroups.com...
> 

>>X-No-Archive:yes
>>
>>I know that visual basic, lisp, python, c , c++ , perl, all have 2
>>value logic. What makes SQL so special that it needs 3vl when all
>>these langauges make do with 2vl?
>>
>>I read a book on SQL which was authored by Date before I knew of the
>>whole Date controversy and when I was learning SQL. I was thoroughly
>>confused when he went on a spiel about nulls. I echoed this sentiment
>>at work and was chastized and told that Date is a kook. Yet I have
>>some time later accepted nulls and work with them just fine. In the
>>back of my mind though, coming from a C++ background I still feel that
>>if c++ can make it on 2vl why not SQL?
>>
>>Why do nulls make us feel so strange?
>
> As you know, 3 valued logic is simple: true, false, don't know.

Actually, I don't know that and neither does anyone else really. The 3-vl semantics in SQL are inconsistent. Sometimes null behaves like unknown and other times it behaves like inapplicable.

  The problem
> with null is that it is often used as a default value which is almost always > surely wrong.

That's hardly the only or even the primary problem. Null--even when handled with the utmost care--breaks fundamental identities.

   Null does not mean N/A, or missing.

Except that sometimes it does.

   That's why you can't do
> arithmetic with it.

What do you mean? x + null = null <-- that's arithmetic.

Except that sometimes x + null = x due to the inconsistencies in SQL.

  Null is a semantic construct that started out correctly > and ended up in most RDMS implementations.

Some of the best minds in database management would disagree that it ever started out correctly.

  FWIW, I try to create subtypes
> where there are no nulls.

That's nice. I simply don't allow null in any database I design. Received on Sat Sep 09 2006 - 04:33:08 CEST

Original text of this message