+11 votes
284 views

In a relational database there are three relations:

• Customers = $C$(CName),
• Shops = $S$(SName),
• Buys = $B$(CName, SName).

Which of the following relational algebra expressions returns the names of shops that have no customers at all? [Here $\Pi$ is the projection operator.]

1. $\Pi _{S Name}B$
2. $S - B$
3. $S - \Pi _{S Name}B$
4. $S - \Pi _{S Name}((C \times S) - B)$
5. None of the above
asked | 284 views

## 3 Answers

+15 votes
Best answer
Answer will be (c)

It subtract  shopnames to those shop  which sells something

So as a result we are getting shops which have no customer
answered by Veteran (70.4k points)
selected by
@Arjun sir please tell me what is the difference between option b and c option b also looking write
option b : not compatible
becoz b is not union compatible ...
+9 votes

c)                                               S                            −                   ΠSNameB
↑

since it has only one attribute no need of projection       it will project all the shop name which has at least                          it will project all the shop name                                         one customer

s1                                                                                                       c1   s1
s2                                                                                                       c2   s2
s3
s4

{s1,s2,s3,s4} - {s1,s2} = {s3,s4}

answered by Veteran (15.4k points)
0 votes
1. $\Pi$SNameB  = shops name from which atleast one customer buys.
2. S−B  =  not Subtraction compatible .
3. S−$\Pi$SNameBS  = Shops from which no customer buy.
4. S−$\Pi$SName((C×S)−B)  = shops name from which every customer buy.
answered by Boss (5.2k points)

+3 votes
1 answer
1
+14 votes
3 answers
2
+5 votes
3 answers
3