Search code examples
databaseentity-relationshiperd

ERD - Entity relationship diagram - complex and tricky relations


Here is the scenario.

Two completely different Entities are independently related to the third entity in the same way. How do we represent it in the ERD? or (Enhanced ER)

Ex:

  • Student "BORROWS" BOOK (from the library)
  • DEPARTMENT "BORROWS" BOOK (from the same library).

If I define 'BORROWS' relationship twice, it would be awkward and clumsy in terms of appearance in the diagram, and increase the complexity of implementation as well.

At the same time, I can not declare a ternary relationship since STUDENT and DEPARTMENT are not inter-related in a relationship-instance.

However, I couldn't find a better way.

How do I solve it?


Solution

  • If Wikipedia is to be believed, Enhanced ER permits inheritance. Why don't you have a BORROWER entity (with the appropriate relationship), and have STUDENT and DEPARTMENT subclass that?