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 are the three degrees of relationship:
- One-to-one (1:1)
- One-to-many (1:M)
- Many-to-many (M: N)
1. One-to-one
- 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, employees and company cars have a one-to-one relationship.
2. One-to-many
- 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.
3. Many-to-many
- In a many-to-many relationship, many occurrences in an entity relate to many occurrences in another entity.
- Same like 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.
0 comments:
Post a Comment
Thanks