# Understanding The Background Of Data Modelling Cordinality.

When performing data modeling in preparation for designing a database, knowing that two entities are related to each other is not sufficient. In addition to knowing that they are related, the cardinality of the relationship must also be documented. Cardinality is the numerical mapping between entities. This describes “how many” of one entity are related to “how many” of another entity. For example, we can say that a Student entity is related to many Course entities and a Course entity is related to many Student entities. Notice that cardinality has a “directional” meaning.

That is, when we say that a Student entity is related to many Course entities, we know nothing about the relationship in the other direction (Course to Student). For this reason, an ER diagram must document (and be read in) both directions.

We will investigate three types of cardinality—one-to-one, one-to-many, and many-to-many.

An example of a one-to-one relationship might be the relationship between a Company Car entity and an Employee entity. An employee is assigned one company car and a company car is assigned to one employee. Note that this relationship might not be true in all companies, that is, in some companies an employee might be assigned to several company cars and/or a company car could be assigned to several employees. It is important to model whatever relationships and cardinality are true for the particular organization under study.

We show a one-to-one relationship on an ER diagram by connecting the two entities with a straight line. Figure above shows an example for the employee and Company Car relationship. You read this diagram in both directions. Starting with Employee, you say that “an Employee is related to one Company Car” and starting at Company Car, you say that “a Company Car is related to one Employee.”

## Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.