dbTalk Databases Forums  

what is union?

comp.databases.theory comp.databases.theory


Discuss what is union? in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
paul c
 
Posts: n/a

Default what is union? - 09-12-2009 , 07:18 PM






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).

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?

Reply With Quote
  #2  
Old   
paul c
 
Posts: n/a

Default Re: what is union? - 09-12-2009 , 07:53 PM






paul c wrote:
Quote:
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}
...
Oops again, sorry, that expression should be (A <AND> B <AND> U) {h}.

Reply With Quote
  #3  
Old   
Mr. Scott
 
Posts: n/a

Default Re: what is union? - 09-12-2009 , 09:35 PM



"paul c" <toledobythesea (AT) oohay (DOT) ac> wrote

Quote:
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.

Quote:
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.

Reply With Quote
  #4  
Old   
paul c
 
Posts: n/a

Default Re: what is union? - 09-12-2009 , 10:00 PM



Mr. Scott wrote:
Quote:
"paul c" <toledobythesea (AT) oohay (DOT) ac> wrote in message
news:YSWqm.43749$Db2.18298 (AT) edtnps83 (DOT) ..
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.
....
Right you are, thanks. I was wondering about <rename> but left that op
out. .

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.