GATE 2022 CS – Question 25
Consider the following three relations in a relational database.
$Employee(\underline{eId}, Name)$, $Brand(\underline{bId}, bName)$, $Own(\underline{eId}, \underline{bId})$
Which of the following relational algebra expressions return the set of eIds who own all the brands?
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (A) $\Pi_{eId}(\Pi_{eId,bId}(Own)/\Pi_{bId}(Brand))$; (B) $\Pi_{eId}(Own)-\Pi_{eId}((\Pi_{eId}(Own)\times\Pi_{bId}(Brand))-\Pi_{eId,bId}(Own))$
Explanation
A is the division operator applied to the pairs and the brand list. B is the classical expansion of division: all employees minus those missing some (employee, brand) pair. C divides by brands that are owned, not all brands. D is ill-formed.