What is Cardinality in DBMS - Example of Cardinalities

cardinality in databaseTo better understand the cardinalities you need to understand what is logical relationship in tables. Whenever a computerized system created it depends on a database system to store the data. The data records are saved in the form of tables (rows and columns).

Tables in database have a major advantage of logical relationship.  Logical relationship allowed us to access one table data using another table records.


Cardinality in Database:

Definition 1:
Cardinality is a relationship or join between rows of  1 table to the rows of another table.

Definition 2:
A number that represents, one instance of first entity(table) is related to how many instances of the second entity, is known as cardinality.

Types of Cardinalities:

Cardinality can be of three types which is also know as relationships between tables (defined in def 1).
  1. zero
  2. one
  3. many



Uses of Cardinalities:
Use of cardinality is to better understand the business purpose of any system and it explains the data model  of any system which help upcoming  developers to understand what are the cardinalities and how to customize.


Examples of Cardinalities:

Let’s take an example in order to illustrate the concepts. There are two entities “Person and Address”.

Minimum Cardinality:

Does every Person need to have an Address? If yes then its minimum cardinality is 1 and if no then its minimum cardinality is 0.

Maximum Cardinality:

Can any given Person have more than one Address? If not then maximum cardinality is 1 and in case of yes, its unbounded, means many and is denoted by *.

Maximum & Minimum Cardinality Difference:

Cardinalities represent the number of occurrences in the related entity. If you use boxes for entities in E-R model, then the outside symbols closed to boxes are called the outside cardinalities or maximum cardinalities. Their symbols can be 1, . And the inside cardinalities called the inside cardinalities or minimum cardinalities. Their symbols can be 0 or 1. Yes optional or compulsory is only for minimum  cardinality, 0 is used for optional and 1 is for compulsory.

Post a Comment

0 Comments