Consider the following three relations:
Employee(eid, eName), Comp(cid, cName), Own(eid, cid).
Which of the following relational algebra expressions return the set of eids who own all brands?
(1) π_eid( π_eid,cid(Own) ÷ π_cid(Comp) )
(2) π_eid( π_eid(Own) × π_cid(Comp) )
(3) π_eid( π_eid,cid(Own) × π_cid(Comp) )
(4) π_eid( π_eid(Own) × (π_cid,cName(Own) ÷ π_cid(Comp)) )
🎥 Video solution / Text Solution of this question is given below:
Reason: To find employees who own all brands, divide the (eid,cid) pairs in Own by the set of all cids in Comp, then project eid:
π_eid( (Own[eid,cid]) ÷ (Comp[cid]) ).