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

From: Alexandr Savinov <spam_at_conceptoriented.com>
Date: Sat, 09 Sep 2006 12:27:01 +0200
Message-ID: <edu4tv$1146$1_at_f1node01.rhrz.uni-bonn.de>


Karen Hill schrieb:
> 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?

Because they have different formal and informal interpretations.

As a matter of fact, in most cases you use 2-valued logic:

   either an element exists in a database or it does not.

So the two values can be called "existence" and "non-existence". Indeed, if your take any database then you either will find some concrete element in it or you will not.

After that the question is how to denote these two cases and how to interpret them formally from the point of view of numerous existing logics. All these issues produce infinite and frequently fruitless debates mostly of religious character. But the fact is that in most practical cases given a database you either find a data item in it or you cannot find it there. 3rd value, 4th value or an infinite number of values (say, fuzzy logic) can be introduced but these approaches are not widely used.

As to nulls, then the simplest and the most natural interpretation of it is as "non-existence". More precisely, null is a marker for a thing that is known to be non-existing. If you ask why to mark things as non-existing, then the answer is that in many cases it is more efficient to use this method instead of physical deletion.

--
http://conceptoriented.com
Received on Sat Sep 09 2006 - 12:27:01 CEST

Original text of this message