An entity-relationship diagram shows sets of entities (represented by rectangles) and n-ary relationships between the entities in those sets (represented by diamonds, and connected by lines to the entity sets it relates). Each rectangle contains the name of its entity set, and each diamond the name of its relationships.
Each line connecting a relationship to the sets of the related entities
may be labelled with a name,
giving the name by which that entity is described
relative to the others in the relationship.
For example,
in Figure 1,
an Employee may be a worker
of a Project
to which it is related by the Project-Worker relationship.
Figure 1.
A relationship between two entity sets
(Chen1976-ermt Fig 10)
Each line connecting a relationship to the sets of the related entities
may be labelled with a cardinality,
indicating how many entities in each set
are related to entities in the other sets.
For example,
in Figure 1
Worker
has cardinality M,
indicating each project may be related to
from zero to M different employees,
and Project
has cardinality N,
indicating each worker may be related to
from zero to N projects.
Each line connecting a relationship to the sets of the related entities may be terminated with an arrow, indicating that entities in that set exist only if part of the specific relation. For example, in Figure 2 every Dependent must be related by Emp-Dep to an Employee. The entity set is given a doubled box in this case.
Figure 2.
Relationships between many entity sets
(Chen1976-ermt Fig 11)
Entity-relationship diagrams were developed for modelling databases.