Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Explain the cardinality concept in DBMS?
In the view of databases, cardinality refers to the uniqueness of data values that are contained in a column. High cardinality is nothing but the column contains a large percentage of totally unique values. Low cardinality is nothing but the column which has a lot of “repeats” in its data range.
Cardinality between the tables can be of type one-to-one, many-to-one or many-to-many.
Mapping Cardinality
It is expressed as the number of entities to which another entity can be associated via a relationship set.
For binary relationship set there are entity set A and B then the mapping cardinality can be one of the following −
One-to-one
One-to-many
Many-to-one
Many-to-many
One-to-one relationship
One entity of A is associated with one entity of B.

Example
Given below is an example of the one-to-one relationship in the mapping cardinality. Here, one department has one head of the department (HOD).

One-to-many relationship
An entity set A is associated with any number of entities in B with a possibility of zero and entity in B is associated with at most one entity in A

Example
Given below is an example of the one-to-many relationship in the mapping cardinality. Here, one department has many faculties.

Many-to-one relationship
An entity set A is associated with at most one entity in B and an entity set in B can be associated with any number of entities in A with a possibility of zero.

Example
Given below is an example of the many-to-one relationship in the mapping cardinality. Here, many faculties work in one department.

Many-to-many relationship
Many entities of A are associated with many entities of B.
An entity in A is associated with many entities of B and an entity in B is associated with many entities of A.
Many to many=many to one + one to many

Example
Given below is an example of the many-to-many relationship in the mapping cardinality. Here, many employees work on many projects.

