GATE / CS ARCHIVE

GATE CSE 1994 / QUESTION 3.8

Intersection using union and difference only

Database Management Systems · Relational Algebra & Calculus · Full GATE CSE 1994 paper

GATE 1994, Q3.8 Descriptive
Report issue

Relational Algebra & Calculus

Question 3.8, GATE 1994: Give an expression equivalent to R∩S using the minimum number of operators from {∪,−}.
Tap to enlarge
Answer & solution

Answer: R−(R−S), using two differences (no official key was published)

The inner R−S contains exactly the R tuples absent from S. Removing those from R leaves the tuples present in both, namely R∩S. This uses two operators. One operator cannot work for arbitrary R,S: R∪S includes exclusive tuples, R−S and S−R keep exclusives rather than common tuples, and applying an operator to a relation twice yields either that relation or the empty relation. Thus two is minimal under set semantics with only R,S and the listed binary operators, assuming union-compatible schemas.

Original paper, page 4