Scenario: I am being asked to create an HR training tracker for employees of a business. in this database I am using two tables:
EMPLOYEE(EMPLID, LastName, FirstName, PrimaryEmail) with EMPLID as the PK, and
SUPERVISOR(SupEMPLID) with SupEMPLID as the FK/PK.
Every instance of SUPERVISOR relates to one and only one instance of EMPLOYEE (because every supervisor is an employee of the company), but not every instance of EMPLOYEE exists as an instance of SUPERVISOR (because not every employee is a supervisor).
I initially defined the relationship between EMPLOYEE and SUPERVISOR as one-to-zero-or-one [1:0,1], because again, each EMPLOYEE relates to zero or one instances of SUPERVISOR. My professor claims it is a one-to-one relationship.
Who is right here?
-------------------------------------------------[Update 1]-------------------------------------------------
- Removed SUPERVISOR entity.
- Created One to One-or-Many relationship between EMPLOYEE and POSITION.
Employee
who has subordinates. This is usually modeled as a self-referencing relationship (with a single top employee as their own supervisor). In your diagram, if you're going to go with the "position" route, it would be a property of thePosition
, not theEmployee
and you'd have to take care to ensure noEmployee
has two positons.EMPLOYEE
reports to one other person. NoEMPLOYEE
reports to no one. The two top positions are the President, and the Dir. Planning & Ops, and both report to one another. I felt a recursive relationship would be insufficient here. Yet, the relationship is still recursive in a way.