Re: The BOOLEAN data type

From: Dieter Nöth <dnoeth_at_gmx.de>
Date: Thu, 03 Apr 2003 09:15:02 +0200
Message-ID: <b6gr24$5797t$1_at_ID-28204.news.dfncis.de>


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"?

> 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 Received on Thu Apr 03 2003 - 09:15:02 CEST

Original text of this message