Contents /
Previous /
Next
Mapping Cardinality
A mapping cardinality is a data constraint that specifies how many
entities an entity can be related to in a relationship set.
Example: A student can only work on two projects, the number of students
that work on one project is not limited.
A binary relationship set is a relationship set on two entity sets.
Mapping cardinalities on binary relationship sets are simplest.
Consider a binary relationship set R on entity sets A and B. There are
four possible mapping cardinalities in this case:
- one-to-one - an entity in A is related to at most one entity
in B, and an entity in B is related to at most one entity in A.
- one-to-many - an entity in A is related to any number of
entities in B, but an entity in B is related to at most one entity in A.
- many-to-one - an entity in A is related to at most one
entity in B, but an entity in B is related to any number of entities in A.
- many-to-many - an entity in A is related to any number of
entities in B, but an entity in B is related to any number of entities in A.
Resolve Many-To-Many Relationships
Many-to-many relationships cannot be used in the data model because
they cannot be represented by the relational model. Therefore,
many-to-many relationships must be resolved early in the modeling
process. The strategy for resolving many-to-many relationship is to
replace the relationship with an association entity and then relate
the two original entities to the association entity.
Example:Employees may be assigned to many projects.
Each project must have assigned to it more than one employee.
A many to many recursive relationship is resolved in similar fashion.