Relationship of higher degree
The degree of relationship can be defined as the number of occurrences in one entity that is associated with the number of occurrences in another entity.
There is the three degree of relationship:
- One-to-one (1:1)
- One-to-many (1:M)
- Many-to-many (M:N)
- In a one-to-one relationship, one occurrence of an entity relates to only one occurrence in another entity.
- A one-to-one relationship rarely exists in practice.
- For example: if an employee is allocated a company car then that car can only be driven by that employee.
- Therefore, employee and company car have a one-to-one relationship.
- In a one-to-many relationship, one occurrence in an entity relates to many occurrences in another entity.
- For example: An employee works in one department, but a department has many employees.
- Therefore, department and employee have a one-to-many relationship.
- In a many-to-many relationship, many occurrences in an entity relate to many occurrences in another entity.
- Same as a one-to-one relationship, the many-to-many relationship rarely exists in practice.
- For example: At the same time, an employee can work on several projects, and a project has a team of many employees.
- Therefore, employee and project have a many-to-many relationship.