In: Computer Science
let r1 and r2 be the relations represented as r1 (ABC)
and r2 (ADE) .Assume the corresponding domains of both the tables
are same.r1 has 2000 tuples and r2 has 4500 tuples
1.common tuples between r1 and r2 are 500, what would be the
resultant number of tuples for r1-r2, justify your answer
2.assuming 500 as the common tuples between r1 and r2,what is the
maximum number of tuples that results in ]] A( r1) U ]] A r2.
justify your answer.
Answer
1) In this problem, between two relations different operation is performed (r1-r2). The difference operation in relation is the same as of set.
A-B={x | x ∈ A and x ∉ B}
This formula states that those elements in A but not in B.
So in this problem there are 500 common tuples.
relation r1 without 500 common tuple= 2000-500=1500
relation r2 without 500 common tuple=4500-500=400
so the result is r1-r2=1500
2) In the second part the operation is Union(U). The operation union in relation is the same as the set.
A-B={x | x ∈ A or x ∈ B}
The formula state that those elements present in either relation A or relation B. Also removing the repeated elements
The result of this problem is
A(r1) U A(r2)=2000+4000=6000