Database Reference
In-Depth Information
Figure 3-1. A simple ER model
Relationships
As you might surmise from Figure 3-1 , relationships represent the connections or associations between entities.
In most cases, the relationship can be expressed using a verb. For example, if you were going to connect people who
use your application with where they live, you would typically express it as “a user has addresses.” In addition, you
would normally want to address cardinality, which measures how many times one entity type might be connected
to another distinct entity type. To express that a user has many addresses, the cardinality would be denoted as “1:M”
(one-to-many).
The relationship objects within the ER diagram usually address the optionality and direction of the association
between entities as well. Addressing the optionality of the relationship can be handled conveniently through its
cardinality. For example, you can express an optional relationship by showing its cardinality as “0:1”. The direction of
the relationship—often referred to as the parent-child —is shown by using an arrow pointing from the parent entity
to the child entity, e.g. Person Address. In addition to arrows and lines with numeric representations, cardinality,
direction, and optionality can be expressed graphically. Figure 3-2 displays the special symbols that are often used in
ER diagrams to express relationships between entities: in this case, a relationship of one to many as one person could
have many addresses.
Figure 3-2. A simple ER model
Attributes
Attributes act as an identity, characteristic, or descriptor for an entity. For example, a User entity might use an identity
attribute (also known as a key ) which is named “Person ID”. The “Person ID” attribute can be used to identify a
specific instance of that entity type. In the case of descriptor attribute, the User entity might include “Person Name” or
“Person Email.”
In some entities, a single attribute might contain one or more of its sibling attributes, which is referred to as a
composite attribute. For example, the Address entity could have the attributes number, street, city, state, and ZIP code,
which together form the composite attribute called “Address”, shown in Figure 3-3 .
 
Search WWH ::




Custom Search