Skip to content

Cardinality

Cardinality decides how many members are present in a relationship on either side. The mapping of cardinality between relationships can be:

  • One to One
  • One to Many
  • Many to One
  • Many to Many

Example

In the examples discussed so far:

  • soldier --> tent is a one-one relationship. one soldier can only reside in one tent, and one tent can house only soldier
  • army --> soldier is a one-many relationship. there are many soldiers fighting in the army, but a soldier can be present in only one army
  • soldier --> weapon is a many-many relationship. a soldier can hold many kinds of weapons, and a weapon variety can be used by any amount of soldiers
  • soldier --> leader is a many-one relationship. each soldier is placed under only one leader, and one leader can lead a group of many soldiers

Representation of Cardinality

  • a directed line signifies one
  • an undirected line signifies many
soldiersoldier_IDnameequipped_weaponweaponweapon_IDweapon_namefirepowertenttent_IDtent_nametent_colourleaderregiment_IDnamecharismaarmyarmy_IDusesresides_inworks_forserves_in

Specific Cardinality Constraints

Like UML diagrams, ER diagrams can also show numbered cardinality constraints. These are also indicated in the same manner

Example

A soldier must be present in one army, and one army only. Meanwhile an army must contain at least one soldier

soldiersoldier_IDnameequipped_weaponarmyarmy_IDserves_in1..*1..1