Re: what is union?

From: Mr. Scott <do_not_reply_at_noone.com>
Date: Sat, 12 Sep 2009 22:35:53 -0400
Message-ID: <pOCdncqW1u4XxzHXnZ2dnUVZ_uKdnZ2d_at_giganews.com>


"paul c" <toledobythesea_at_oohay.ac> wrote in message news:YSWqm.43749$Db2.18298_at_edtnps83...
> Regarding so-called "union compatibility",.suppose relations A and B with
> equal headings, say named h. Suppose non-empty relation U with only one
> attribute that is not in any other heading.
>
> value i): A Join B projected on h, D&D style =
> (A <AND> B) {h}
>
> value ii): A Union B (with unrestricted <OR> and Union restricted to equal
> headings) =
> {A <OR> B)
>
> Every tuple in A and every tuple in B is in value i), no tuple in A or B
> is not in value i), likewise for value ii).

If A and B have the same heading, then you're wrong. Suppose that no tuple in A is also in B, then A Join B would be empty, as would A <AND> B <AND> U. A Union B, on the other hand, would contain every tuple in either A or B.

> We could use the expression of value i) to "insert" to relvars, even
> define a union view. So what makes union different from projection of
> join?
>

The difference is as plain as the difference between logical disjunction and conjunction.

Suppose that you have two relations with the same heading, A{x,y} and B{x,y}, such that

A =
{{x:=1,y:=2),{x:=3,y:=3},{x:=5, y:=4}}

B =
{{x:=2,y:=2),{x:=3,y:=3},{x:=4, y:=4}}

Then

A JOIN B =
{{x:=3,y:=3}}

A UNION B =
{{x:=1,y:=2),{x:=2,y:=2),{x:=3,y:=3},{x:=4, y:=4},{x:=5, y:=4}}

Notice that the join only contains those tuples that appear on BOTH A and B, but the union contains those tuples that appear in EITHER A or B. Received on Sun Sep 13 2009 - 04:35:53 CEST

Original text of this message