Re: The BOOLEAN data type
Date: Thu, 03 Apr 2003 12:32:45 -0800
Message-ID: <b6i5el$5d9rs$1_at_ID-152540.news.dfncis.de>
Dieter Nöth wrote:
> Costin Cozianu wrote:
>
>> Let there be a a panel of judges who will "judge" if Joe Celko's
>> contributions to the above threads are "good" as opposed to "bad"
>> (unreasonable, misleading, containing bad advice).
>
>
> You already say that there are many different "bads", so why not using
> different values indicating "unreasonable", "misleading", "containing
> bad advice", "good", "excellent"... instead of black/white, yes/no?
> Or similar to school marks "A" to "F"?
>
Because the user doesn't care. He needs to know good just if the contribution is good. Tons of real life applications with true/false is in distributed knowledge management applications.
Let there be a proposition P, we want to know if agent X considers the propositions true/false or just he can't tell.
Refining the specifications beyond what the user needs and asks for is bad practice.
>> Here's a minimal and natural solution with the boolean data types. I
>> leave the constraints as an exercise for the reader, because you made
>> SQL way too verbose for me to bother :)
>>
>> CREATE TABLE THREADS (
>> thread_id varchar,
>> thread_subject varchar)
>>
>> CREATE TABLE JUDGES (
>> judge varchar
>> )
>>
>> CREATE TABLE JUDGEMENTS (
>> thread_id varchar,
>> judge varchar,
>> is_good boolean
>> )
>>
>> and then I'd insert for this particular thread:
>>
>> INSERT INTO JUDGEMENTS
>> VALUES ( 'W1Hia.19%243l2.962647%40mantis.golden.net', 'Costin
>> Cozianu', false )
>>
>> If I want to say that your contribution is good I'd put a "true". If I
>> am in doubts or have mixed feelings, I don't want to pronounce, I
>> won't insert anything.
>
> >
>
>> Voila: a natural usage of boolean datatype, *and* there are no NULLs
>> in the table, and no NULLs are ever needed in this case. Plus the
>> schema is very easy to use in programs, queries, reports, OLAP
>> thingies :)
>
>
> If you don't insert anything it's a NULL ;-)
>
> Dieter
>
Not quite. An empty set is very different from NULL in many aspects, not the least of which is that it poses absolutely no complication to basic logic and set theory.
Costin Received on Thu Apr 03 2003 - 22:32:45 CEST