retagged by
8,434 views
14 votes
14 votes

Consider the following three relations in a relational database.

$\text{Employee} (\underline{\text{eId}},\text{Name}), \; \text{Brand}(\underline{\text{bId}},\text{bName}), \; \text{Own}(\underline{\text{eId}},\underline{\text{bId}})$

Which of the following relational algebra expressions return the set of $\textit{elds}$ who own all the brands?

  1. $ \Pi_{eId} \left(\Pi_{eId,bId} (Own) / \Pi_{bId} (Brand) \right)$
  2. $ \Pi_{eId} (Own) – \Pi_{eId} \left( ( \Pi_{eId} (Own) \times \Pi_{bId} (Brand)) – \Pi_{eId,bId} (Own)\right)$
  3. $ \Pi_{eId} \left(\Pi_{eId,bId} (Own) / \Pi_{bId} (Own) \right)$
  4. $ \Pi_{eId} \left( (\Pi_{eId}(Own) \times \Pi_{bId} (Own)) / \Pi_{bId} (Brand) \right)$
retagged by

2 Answers

5 votes
5 votes
Correct option is  A,B.

The answer to the asked query is simply the division operation.

Option A is simply they have provided the division operation.

Option B:- They wrote the division operation by simply Basic Relational operator .
5 votes
5 votes

Option A-It will give eid which will pair with every bid of brand so this will give correct answer.

Option B-In this option first there is a cross product between eid of Own and bid of BRAND so it will give all combination of eid and bid then there is a set difference between eid,bid of Own table this will give all employees which does not own all brand.Then at last there is set difference with eid of Own,so it will give eid which pair with every bid of brand (eid which owns all brand)

Option C-it will give eid which pair with every bid of Own (not brand) so this will give wrong answer.

Option d- 

Suppose there is an instance of Own(eid,bid) like this (e1,b1) (e1,b2) (e2,b1) and suppose in brand there are only two bid b1 and b2 so it should give e1 as answer but according to option d there will be cross product between eid of Own and bid of Own so after cross product it will look like this (e1,b1), (e1,b2),(e2,b1),(e2,b2) and after performing division with bid of brand it will give eid e1 and e2 as answer which is wrong.

So this is incorrect

option A and option B are correct.

 

 

 

 

 

 

 

Answer:

Related questions