Employee Database - ndgriffeth/Class-Notes-and-Lectures GitHub Wiki
The tables
departments: (Entity) Each row represents a department.
employees: (Entity) Each row represents an employee.
dept_emp: (Relationship) Each row represents an employee working for a department. The employee may work for a department for a period of time, and then change to another department. Also, each department has many employees; so this is a many-to-many relationship.
dept_manager: (Relationship) Each row represents a manager managing a department. The manager may manage the department for a period of time, and then a different manager comes in. Each manager can manage multiple departments (over time) and each department can be managed by multiple managers (over time), so this is a many-to-many relationship.
salaries: An employee has a salary. At any point in time, the employee has only one salary, but over time, the salary may change. This is a one-to-many relationship (many salaries for one employee). This is known as a one-to-many identifying relationship, because knowing the salary requires referring to the employee (note that the foreign key to the employees relation is part of the primary key of the salaries relation.
titles: An employee has a title. At any point in time, the employee has only one title, but over time, the title may change. This is a one-to-many relationship (many titles for one employee). This is known as a one-to-many identifying relationship.