Week 11-12: Cardinality Constraints in Database
Cardinality constraint defines the maximum number of relationship instances in which an entity can participate.
Types of Cardinality Ratios-
- Many-to-Many cardinality (m:n)
- Many-to-One cardinality (m:1)
- One-to-Many cardinality (1:n)
- One-to-One cardinality (1:1 )
1. Many-to-Many Cardinality-
By this cardinality constraint,
- An entity in set A can be associated with any number (zero or more) of entities in set B.
- An entity in set B can be associated with any number (zero or more) of entities in set A.
2. Many-to-One Cardinality-
By this cardinality constraint,
- An entity in set A can be associated with at most one entity in set B.
- An entity in set B can be associated with any number (zero or more) of entities in set A.
3. One-to-Many Cardinality-
By this cardinality constraint,
- An entity in set A can be associated with any number (zero or more) of entities in set B.
- An entity in set B can be associated with at most one entity in set A.
4. One-to-One Cardinality-
By this cardinality constraint,
- An entity in set A can be associated with at most one entity in set B.
- An entity in set B can be associated with at most one entity in set A.