Discover the relationships
You can ignore the shaded portion of the matrix. You must consider the diagonal cells; that is, you must ask the question, “What is the relationship between an A and another A?” In this model, the answer is always none. No relationship exists between a name and a name or an address and another address, at least none that you are required to record in this model. When a relationship exists between an A and another A, you have found a recursive relationship. (See Resolve other special relationships.)
Although no entities relate to themselves in this model, this situation is not always true in other models. A typical example is an employee who is the manager of another employee. Another example occurs in manufacturing, when a part entity is a component of another part.
- One-to-one (1:1), in which not more than one entity A exists for one entity B and not more than one B for one A.
- One-to-many (1:n), in which more than one entity A never exists, but several entities B can be related to A (or vice versa).
- Many-to-many (m:n), in which several entities A can be related to one B and several entities B can be related to one A.
One-to-many relationships are the most common. The telephone directory model shows one-to-many and many-to-many relationships.
0-1
opposite name and below address,
as Figure 3 shows.
Ask yourself how many addresses can be associated with a name. You decide that an address can be associated with more than one name. For example, you can know several people at one company or more than two people who live at the same address.
0-n
, as Figure 4 shows.
If you decide that an address
cannot exist unless it is associated with at least one name, you write 1-n
instead
of 0-n
.
When the cardinality of a relationship
is limited on either side to 1
, it is a 1:n relationship.
In this case, the relationship between names and addresses is a 1:n
relationship.
0-n
opposite name and
below number (voice), as Figure 5 shows.
- A name can be associated with more than one fax number; for example, a company can have several fax machines. Conversely, a fax number can be associated with more than one name; for example, several people can use the same fax number.
- A modem number must be associated with exactly one name. (This is an arbitrary decree to complicate the example; accept it as a requirement of the design.) However, a name can have more than one associated modem number; for example, a company computer can have several dial-up lines.
- Although some relationship exists between a voice number and an address, a modem number and an address, and a fax number and an address in the real world, none of these relationships must be recorded in this model. An indirect relationship already exists through name.
Other decisions that the matrix reveals are that no relationships exist between a fax number and a modem number, between a voice number and a fax number, or between a voice number and a modem number.
You might disagree with some of these decisions (for example, that a relationship between voice numbers and modem numbers is not supported). For the sake of this example, these are our business rules.