Re: Transitive Closure
Date: 16 May 2004 16:49:21 -0700
Message-ID: <e4330f45.0405161549.7f66ece8_at_posting.google.com>
mikharakiri_nospaum_at_yahoo.com (Mikito Harakiri) wrote in message news:<8a529bb.0405160919.73cf214b_at_posting.google.com>...
> Both TC and selection (I prefer that name that pops up on the first
> page when googling "Relational Algebra")
I prefer restriction. What selection does is a restriction.
> are unary relational operators.
No, even in the page you mention you can see that selection is a binary operator:
R2 = select(R1,P)
BTW it is not a commutative operator:
select(R1, P) <> select(P, R1)
In the second case the operation is undefined.
> So we are talking about composition operation applied to
> operators and commutativity of this operation.
We are talking about the order of the operations, not about the order of the operands.
1+2 = 2+1 thanks to the commutative property of the sum (1+2)+3 = 1+(2+3) thanks to the associative property of the sum
In the first case we have one operation and in the second case we have two.
> In relational world operator commutativity is very important. Although
> Relational Algebra appears to be more procedural than relational
> calculus (apply this selection, then, apply this projection, and so
> on), this syntactic order doesn't really matter as selection and
> projection commute to about every other operator.
No.
(a union b){c, d} = a{c, d} union b{c, d) because projection DISTRIBUTES over union, intersection, and join, but not over difference:
(a minus b){c, d} <> a{c, d) minus b{c, d}
It is trivial to find an example.
> This is why
> select-project-join is expressed in good old SQL as:
>
> select ... from A,B,C where ...
The messy SQL is very confusion prone.
Translated to algebra this is:
Project(Restrict(CartesianProduct(A,B,C), ...), ...)
Projection and restriction distribute over the cartesian product, but try with an EXCEPT clause.
Regards
Alfredo
Received on Mon May 17 2004 - 01:49:21 CEST
