0
3.5kviews
You have to design and implement a database that manages information about publishers, authors, and books.

You have to design and implement a database that manages information about publishers, authors, and books.

Some information includes

  • A publisher has a name and an address for the headquarters. Each publisher also has a set of branches, each branch having an address and two phone numbers.
  • An author has a name and an address.
  • A book is published by a publisher and has a list of authors associated with it. An author can publish several books and a book can be published by at most one publisher.

    a. Design an ODL schema for the above database

    b. Write in OQL the following query:

List the name of the author who has published the most books with publisher

1

Creating ER Diagram for easy visualization

enter image description here

a. ODL schema for the above database

module Publication {
    interface Publisher {
        attribute string Pname;
        attribute string Headquarter_Addr;
    }
    interface Branches {
        attribute string Phone;
        attribute string Branch_Addr;
        relationship set <Publisher> PubName inverse Publisher::Pname;
    }
    interface Book {
        attribute string ISBN;
        attribute string Book_Name;
        relationship set <Publisher> PubName inverse Publisher::Pname;
    }
interface Author {
        attribute string Aname;
        attribute string Auth_Addr;
    }
    interface Authorship {
        relationship set <Author> Aname inverse  Book::Aname;
        relationship set <Book> ISBN        inverse  Book::ISBN;
    }

}

b. OQL for the query – List the name of the author who published the most books with publisher “McGraw Hill”

SELECT A.Aname FROM A in Authorship, B in Book
WHERE B.PubName = ‘McGraw Hill’ AND A.ISBN = B.ISBN

Please log in to add an answer.