Chapter 3 Data Modeling Using the Entity-Relationship (ER) Model

As mentioned in the previous chapter, the ER model describes data as entities, relationships, and attributes.

Figure 3.1 An ER schema diagram for the $\textrm{COMPANY}$ database.

Figure 3.1 An ER schema diagram for the $\textrm{COMPANY}$ database.

This figure will be explained gradually as the ER model concepts are presented.

<aside> <img src="/icons/map-pin_gray.svg" alt="/icons/map-pin_gray.svg" width="40px" /> Note that you may find variants of the notation used here and the symbols may differ from ones we use.

</aside>

Entity

The basic concept that the ER model represents is an entity, which is a thing or object in the real world with an independent existence.

Figure 3.2 Notations for entity and weak entity.

Figure 3.2 Notations for entity and weak entity.

In figure 3.1, we define $\textrm{EMPLOYEE}$, $\textrm{DEPARTMENT}$, $\textrm{PROJECT}$, and $\textrm{DEPENDENT}$ as an entity and each of them has attributes. There’s two types of entity:

  1. Strong entity, sometimes called owner or dominant entity type.
  2. Weak entity, sometimes called dependent or subordinate entity type.

Typically, we just refer to strong entity as entity, then weak entity as is. But, what exactly is the difference between the two?

Strong Entity Weak Entity
It is represented by a single rectangle. It is represented by a double rectangle.
It always has a primary key, which is underlined. It has a partial key, which has a dashed line.
It is not dependent on any other entity. It depends on strong entity.
Strong entities have either total participation or not. While, weak entities has total participation.

We’ll use an example to explain to demonstrate the first three points.

For the last point, we’ll begin by defining what is a relationship in an ER model.

Relationship

A relationship type represents the association between entity types.