Database Reference
In-Depth Information
Relationships
The term relational database implies the use of relationships, right? If you
don't know how data is related, using a relational database to simply store
information is no different from dumping all your receipts, paycheck stubs,
and financial statements into a large trash bag for storage. Tax season
would be a nightmare; sure, all the data is there, but how long would it take
you to sort out the relevant information and file your taxes?
The real power of a relational database lies in the efficient and flexible
storage and retrieval of data. Identifying and implementing the correct re-
lationships in a logical model are two of the most critical design steps. To
correctly identify relationships, it's important to understand all the possi-
bilities, know how to recognize each one, and determine when each should
be used.
Relationship Types
Logically, there are three distinct types of relationships between entities:
one-to-one, one-to-many, and many-to-many. Each represents the way two
entities logically relate to each other. It is important to remember that
these relationships are logical; physical implementation is another step, as
discussed later in Chapter 9.
One-to-One Relationships
Simply put, a one-to-one relationship between two entities is, as the name
implies, a direct match between the entities. For each record in the first
entity, there is one matching record in the second entity, no more and no
less. For example, think of two people playing catch with a ball. There is
one thrower and one receiver. There cannot be more than one thrower,
and there cannot be more than one catcher (in terms of someone actually
catching the ball).
Why would you choose to create a one-to-one relationship? Moreover,
if there is only one matching record in each entity for a given piece of data,
why wouldn't you combine the entities? Let's take a look at Figure 2.2.
For any given school, there is only one dean, and for any given dean,
there is one school. In the example, all of the attributes of a Dean entity
 
 
Search WWH ::




Custom Search