The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+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 in Databases by Veteran (42.9k points) | 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)

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

29,156 questions
36,980 answers
92,147 comments
34,822 users