Re: boolean datatype ... wtf?

From: Bob Badour <bbadour_at_pei.sympatico.ca>
Date: Wed, 29 Sep 2010 14:04:50 -0300
Message-ID: <4ca371af$0$14802$9a566e8b_at_news.aliant.net>


paul c wrote:

> On 29/09/2010 8:45 AM, Bob Badour wrote:
>

>> paul c wrote:
>>
>>> On 29/09/2010 7:45 AM, Bob Badour wrote:
>>>
>>>> Paul Mansour wrote:
>>>>
>>>>> On Sep 29, 9:46 am, paul c <toledobythe..._at_oohay.ac> wrote:
>>>>>
>>> ...
>>>
>>>>>> 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.
>>>> ...
>>>
>>>
>>> Thanks for the precise example. It seems to me that Date means your
>>> last sentence as his starting point. Nothing 'wrong' with that, but my
>>> question might be 'why does that have to be so'? Isn't it just as
>>> valid to say that R can be one of DEE or DUM for certain f?
>>
>>
>> Sure, but that's a different f. The first f is part of a closed boolean
>> algebra, and the second f is not.

>
>
> Okay, then my next question is why couldn't any operation on relations
> return a relation? eg., subsetof(r1,r2).
>
> Is it because language designers want to use the same 'type' for ops
> that don't operate on relations? If so, I'd say that's their right,
> just as it's Erwin S's right to call "whether A=B should be treated as a
> relation" hairsplitting. I don't see a logical requirement for either
> attitude, although I'm sure there are lots of practical ones.
>
> Regarding division by zero, as impractical as it might be, I also might
> have a mental block about that. If there were an op called 'integer
> division', is there a theoretical reason why its operands couldn't be
> relations and the result an empty relation?

No. The result of 1/0 is undefined not an empty set of values, and the result of 0/0 is indeterminant not the set of all integers. Dividing by zero is not the only case where division is not closed on integers: 1/2 is not an integer. Received on Wed Sep 29 2010 - 19:04:50 CEST

Original text of this message