Relational Algebra & Calculus



Answer & solution
Answer: π_SCODE(σ_PRCODE='PR1'(SPPR)) ∩ π_SCODE(σ_PRCODE='PR2'(SPPR)). (no official key was published)
First select shipments to PR1 and project their supplier codes: A=π_SCODE(σ_PRCODE='PR1'(SPPR)). Separately form B=π_SCODE(σ_PRCODE='PR2'(SPPR)). Both expressions have the same one-attribute schema, so set intersection is defined. The answer is A∩B.
Membership in the intersection requires a shipment witness to each project. The witnesses need not have the same part, quantity or shipment record. Selecting PRCODE='PR1' AND PRCODE='PR2' on a single tuple would be wrong because one shipment tuple cannot have two different project codes. Selecting with OR and projecting without intersection would also be wrong: it admits suppliers serving only one project. Under standard relational-algebra set semantics projection automatically eliminates duplicate supplier codes.