Re: thinking about UPDATE

From: Jan Hidders <jan.hidders_at_REMOVETHIS.pandora.be>
Date: Thu, 22 Jul 2004 21:48:53 GMT
Message-ID: <pan.2004.07.22.21.49.40.338698_at_REMOVETHIS.pandora.be>


On Thu, 22 Jul 2004 13:21:17 -0700, Mikito Harakiri wrote:
>
> Consider FD
>
> {A.X, A.Y} -> {A.Z}
>
> whish means
>
> not exists a1,a2 ( a1.x = a2.x & a1.y = a2.y & a1.z != a2.z )
>
> This expression in RA is formally view equation
>
> sel(a1.x = a2.x) sel(a1.y = a2.y) sel(a1.z != a2.z) A(+)A = {}
>
> where (+) denotes Cartesian Product
>
> Let's apply projection to both sides of the equation:
>
> prj({a1.x, a1.z}) prj({a2.x, a2.z}) sel(a1.x = a2.x) sel(a1.y = a2.y)
> sel(a1.z != a2.z) A(+)A = {}
>
> Projection commutes with selection and cartesian product (does it?)

It does, if you select on attributes that you project. So to be completely correct you probably should have said:

 prj({a1.x, a1.y, a1.z}) prj({a2.x, a2.y, a2.z}) sel(a1.x = a2.x) sel(a1.y

  • a2.y) sel(a1.z != a2.z) A(+)A = {}

But that's nitpicking.

> so that we can push it all way down to the base relation
>
> sel(a1.x = a2.x) sel(a1.z != a2.z) [prj({a1.x, a1.z})A](+)[prj({a2.x,
> a2.z})A] = {}
>
> Which proves that the "projected" FD holds in a projected relation.

Very nice! An algebraic proof. Tarski would have been proud. :-) And of course it also shows that if it holds in the projection then also in the original relation.

  • Jan Hidders
Received on Thu Jul 22 2004 - 23:48:53 CEST

Original text of this message