Re: boolean datatype ... wtf?

From: Bob Badour <bbadour_at_pei.sympatico.ca>
Date: Wed, 29 Sep 2010 11:45:24 -0300
Message-ID: <4ca35100$0$14806$9a566e8b_at_news.aliant.net>


Paul Mansour wrote:

> On Sep 29, 9:46 am, paul c <toledobythe..._at_oohay.ac> wrote:
>

>>On 29/09/2010 4:51 AM, Paul Mansour wrote:
>>...
>>
>>>What is the problem with a Boolean data type?
>>>.
>>>It is fundamental - so fundamental  that in TTM it is the only
>>>required scalar data type:  “We require that at least one built-in
>>>scalar type be supported : Namely, type “Boolean” (BOOLEAN in Tutorial
>>>D”).
>>
>>>Date and Darwen go on to give the obvious reasons for this.
>>
>>>The fact that DEE and DUM may be interpreted as TRUE and FALSE is not
>>>relevant.  The result of A=B or A>B is not a relation.
>>
>>Aren't A=B and A>B relations?

>
> I was under the impression that they are not, even if A and B are
> relations. But I may have misintepreted C.J. Date on this.
>
> In "Database in Depth" he writes:
>
> "In Chapter 2, I mentioned the fact that the equality comparison
> operator "=" applies to every type. In partitular, therefore it
> applies to relation types.... Now I must immediatly explain that these
> opeartors are not relational operators as such -- that is they are not
> part of the relational algebra-- because their result is a truth
> value, not a relation."

An algebra is a set of values and a set of operations closed on that set of values.

Date is saying that comparisons are not part of the relational algebra in the same way that division is not part of the integer algebra because dividing any two arbitrary integers is not necessarily closed on integers.

Consider an expression of the form:

R = f(A,B)

where both A and B are relations and f is some binary operation. If f is natural join, then R is a relation. If f is a comparison, then R is not a relation; it is a boolean.

Similarly, if A and B are integers and f is multiplication, then R is an integer whereas if f is division, R is not necessarily an integer.

The expression R = f(A,B) itself, however, is always a relation. We could re-express the relation as g(R,A,B) g: {(R,A,B)| R = f(A,B)}

If f is part of some algebra, all three of R, A and B, will have the same type.

If one does away with the form R = f(A,B) entirely, then comparison is just a relation Eq(A,B) and natural join is just a relation Jn(R,A,B) and division is just a relation Dv(Quotient,Dividend,Divisor) | Divisor != 0. Received on Wed Sep 29 2010 - 16:45:24 CEST

Original text of this message