Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2016

    Unanswered: Relational algebra help


    I have 2 tables Author(AuthorID, Name,DateofPublication) and Buyer(BuyerID, BuyerName, Date, AuthorID)

    I have to select which author has atleast one of their books bought by all the buyers.

    Now I am able to figure out to do this in 2 steps:
    1. Select all AuthorID which have been bought by all Buyers
    2. Select Author Name that have the same AuthorId as AuthorID selected in point 1

    I know how to write point 2 in relational algebra - it is a simple join ( Projection(Name) (Author) Join AuthorID=AuthorID(Buyer))
    But I don't know how to write Point 1.

    Please help . Also , please tell if I am thinking in the right direction


  2. #2
    Join Date
    Mar 2007

    the design seems to be flawed. Is really one BUYER supposed to buy at most one AUTHOR? Additionally, in the second paragraph you are mentioning BOOKS (which makes more sense in real world), however there is no table representing this entity.

    I am afraid that there is no way to obtain the required information from the mentioned tables only. If the missing tables (BOOKS and SALES for respective entities), it is as simple as comparing the count of BUYERs with the count of rows in SALES (the new one) table with the given BOOK.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts