Consider the relation schemas R(A, B) and S(A) with the following tuple sets.…
2017
Consider the relation schemas R(A, B) and S(A) with the following tuple sets.
Relation R(A, B):
A | B |
|---|---|
a1 | b1 |
a2 | b1 |
a3 | b1 |
a4 | b1 |
a1 | b2 |
a3 | b2 |
a2 | b3 |
a3 | b3 |
a4 | b3 |
a1 | b4 |
a2 | b4 |
a3 | b4 |
Relation S(A) = {a1, a2, a3}
What is T ← R / S, where “/” denotes the relational-algebra division operation?
Answer: C. T(B) = {b1, b4} — ConceptRelational division R ÷ S returns each value of the non-divisor attribute B for which R contains a tuple with every A-value present in S. Values of A…
- A.
T(B) = {b1, b3}
- B.
T(B) = {b1, b2, b4}
- C.
T(B) = {b1, b4}
- D.
T(B) = {b1, b3, b4}
Attempted by 424 students.
Show answer & explanation
Correct answer: C
Concept
Relational division R ÷ S returns each value of the non-divisor attribute B for which R contains a tuple with every A-value present in S. Values of A outside S neither add nor remove a qualifying B-value.
Application
The divisor relation supplies the required set S(A) = {a1, a2, a3}.
Group the tuples of R by B and compare each group with the required A-values:
B value
A-values present in R
Contains every value of S?
b1
{a1, a2, a3, a4}
Yes
b2
{a1, a3}
No; a2 is absent
b3
{a2, a3, a4}
No; a1 is absent
b4
{a1, a2, a3}
Yes
The qualifying B-values are b1 and b4, because both include a1, a2, and a3.
Cross-check
For b1 and b4, all three required tuples are present. The tuple (a4, b1) is extra information because a4 is not in S; b2 lacks (a2, b2), and b3 lacks (a1, b3).
Result
Therefore, T(B) = {b1, b4}.