Cardinality In ER Diagram

Download PDF
Advertisement

Cardinality In E-R Diagram

Cardinality In ER Diagram: In a relational database model, the number of records in a table or relation is called cardinality in the E-R Model of the database. However, relationship types usually have certain constraints that limit the number of instance of one entity type that can be associated with each instance of another related entity type.

Therefore, the cardinality of a relationship is defined as; the number of instances of one entity type that can be associated with each instance of another related entity type.

Suppose there are two entity types A and B that are connected by a relationship R in the E-R Model of the database of same data file. If there are no cardinality constraints on R, then any number of instance A can be associated with any number of instances of B. Usually there are cardinality constraints such as,

  • If there is one-to-one relationship between A and B, then each of the instance in A will be associated with exactly one instance in B. Conversely each instance in B will be associated with exactly one instance in A.
  • If there is one-to-many relationship between A and B, then each instance in A will be associated with many instance in B. On the other hand, each instance in B will be associated with exactly one instance in A.
    Advertisement
  • If there is many-to-many relationship between A and B, then each instance in A will be associated with many instance in B. On the other hand, each instance in B will also be associated with many instances in A.

The cardinality of one id denoted by a small vertical line ( │ ) on the relationship line, next to the first entity type or before the second entity type.

For example a department may have many teachers. On the other hand, a teacher belongs to one department. The relationship between DEPARTMENT and TEACHER is shown as

Modality of Relation

The modality defines the nature of relationship as either it is optional or mandatory. If the minimum instance in one entity is zero for an instance of another related entity, then the relationship is called optional. The optional relationship is denoted by small circle “O” on the relationship line.

Similarly if the minimum instance in one entity is one for an instance of another related entity, then the relationship is referred to as mandatory. It is denoted by a small vertical line “│” on the relationship line. If the maximum and minimum cardinalities are both one, it is known as Mandatory one Cardinality in ER diagram.

 

Relationship In Database

Advertisement