Cardinality in DBMS

By Mona Kumari|Updated : April 20th, 2022

Cardinality in DBMS: In a database management system, the term "cardinality" refers to the maximum number of relationship instances in which an entity can participate. In this article, we will learn about cardinality in DBMS. Before jumping onto the topic, let us first discuss the mapping cardinality or cardinality ratio. It tells the number of entities to which another entity can be associated via a relationship set.

Mapping cardinality or cardinality ratio uses the binary relationship set. The cardinality ratio that is possible for binary relationships are:

  • One to One(1: 1)
  • One to Many(1: M)
  • Many to One(M: 1)
  • Many to Many(M: M)
Table of Content

One to One(1: 1)

A one-to-one relationship exists when only one instance of an individual is connected with at most one entity of another (same) entity set via relationship instance.

An entity(tuple) in E1 is associated with at most one entity(tuple) in E2, and an entity in E2 is associated with at most one entity in A.
Example:

byjusexamprep

Candidate keys of relation R(A, B) = A, B

One to Many (1: M)

A one-to-many relationship exists when only one instance of an entity is connected with many entities of another entity set via relationship instances.

An entity(tuple) in E1 is associated with zero or more entities in E2, but an entity in E2 can be associated with at most one entity in E1.
Example:


Candidate key of R (A, B) = B

Many to One (M: 1)

A many-to-one relationship exists when more than one instance of the entity set is on the left and only one instance of the entity set on the right is associated with the relationship. 

An entity(tuple) in Ę2 is associated with zero or more entities in E1 but an entity in
E1 can be associated with at most one entity in E2.
Example:

Candidate key of R (A, B) = A

Many to Many (M: M)

A many-to-many relationship exists when more than one instance of the entity set is on the left and more than one entity of another entity set is on the right is associated with the relationship.

An entity(tuple) in E2 is associated with zero or more entities in E1, and an entity(tuple) in E1 is associated with zero or more entities in E2.
Example:

Candidate key of R(A, B) = AB

BYJU's Exam Prep Online Classroom Program 

Thanks

#DreamStriveSucceed

Comments

write a comment

FAQs

  • Cardinality in DBMS usually represents the relationship between the data of two different tables by highlighting how many times a specific relation entity occurs compared to another.

    For example, the database of the student may show that the student enrolled on multiple courses.

  • The cardinality ratios that are possible for binary relationships are:

    • One to One(1 : 1)
    • One to Many(1 : M)
    • Many to One(M : 1)
    • Many to Many(M : M)
  • Cardinality is important because it creates relations from one table or entity to another in the structured manner. As a result, cardinality significantly impacts the query execution plan. A query execution plan is a sequence of steps users can take to access data and search for the data stored in a database system. Therefore having a well-structured query execution plan can make it easier for users to quickly locate the data they need.

  • The index cardinality in DBMS is the total number of distinct key values for each index in the relation.

  • The many to one and one to many cardinality in DBMS is not the same as one-to-many relationships exist when only one instance of an entity is connected with many entities of another entity set via relationship instances. On the other hand, a many-to-one relationship exists when more than one instance of the entity set is on the left. Only one instance of the entity set on the right is associated with the relationship. 

Follow us for latest updates