GATE CSE
First time here? Checkout the FAQ!
x
+10 votes
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
asked in Databases by Veteran (38.7k points)   | 228 views

2 Answers

+13 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 (58.3k 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 ...
+8 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.1k points)  

Related questions



Top Users Sep 2017
  1. Habibkhan

    6362 Points

  2. Warrior

    2234 Points

  3. Arjun

    2212 Points

  4. nikunj

    1980 Points

  5. manu00x

    1726 Points

  6. SiddharthMahapatra

    1718 Points

  7. Bikram

    1716 Points

  8. makhdoom ghaya

    1660 Points

  9. A_i_$_h

    1552 Points

  10. rishu_darkshadow

    1512 Points


25,991 questions
33,561 answers
79,413 comments
31,029 users