228 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

It subtract  shopnames to those shop  which sells something

So as a result we are getting shops which have no customer
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 ...

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}

1
2