Is it okay to have this kind of relationship in an ERD?



  • https://imgur.com/a/FO26YA9

    The Staff connects to the manager and branch

    the branch connects to staff and manager.

    Note that one branch can only contain one manager.

    Questions:

    1. If it is wrong, how can I design it?

    2. Is it okay if I add two relationships between the tables?

    3. Is it possible just to add an attribute such as isManager().



  • If it is wrong, how can I design it?

    Is it okay if I add two relationships between the tables?

    If a Manager can manage a Branch they're not a Staff of, then it seems fine as-is. Otherwise, Manager.branchNo should be removed since it duplicates what's in the Staff table.

    Is it possible just to add an attribute such as isManager

    Yes. This is the simplest in structure. If there's additional information associated with manager, a separate Manager table would prevent cluttering non-manager entries in Staff with null manager data. Otherwise, SELECT 1 FROM Manager WHERE staffNo = x checks if Manager.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2