Database Reference
In-Depth Information
F IGURE 8.2
The Customers entity with the address data correctly split out
As you can see, the new entity has each address attribute only once,
and we have added a new attribute called Description. The description al-
lows Mountain View to identify the address at the time of entry. Splitting
the address data out of the customer entity in this way allows for more flex-
ibility and eliminates the need to change the application or the data model
later. With this model, the company is no longer limited to only a home and
a work address; it can now enter as many as it likes. Maybe the customer
has two houses or wants to ship something as a gift. Either way, our new
model allows it.
This kind of thing can happen often when you are building a model.
You mistake what should be a second entity for attributes of the entity you
are building. This error isn't limited to things like addresses, which are at-
tributes of customers. It can also happen with two completely different
items that end up in the same entity. For example, suppose we're storing
data about classes at a local college. If we create a Class entity, we need to
track the professor for each class. The quick—and might we say, sloppy—
way is to add a few attributes to the Class entity to track the information
about the professor, as shown in Figure 8.3.
F IGURE 8.3
A Class entity that also contains Professor information
 
Search WWH ::




Custom Search