Database Reference
In-Depth Information
the street address from the rest of the detail provided a space savings be-
cause that information wasn't ever repeated.
Having too many entities can slow the performance of the database
after it's implemented. As good data modelers, not only should we care
about normalization and clever data storage, but also we need to be cog-
nizant of the performance implications of our decisions in the model.
Attribute Problems
The biggest hurdle you will encounter when working with attributes is
making sure that they are appropriate and store the correct data. Too
often, we put unneeded attributes in entities or we misuse the attributes
that are there. Remember your normalization rules: Each attribute should
hold only one kind of data. It is tempting to go the easy route and create
columns called attribute1 and attribute2, but that is a trap you want to
avoid. Let's look at other common attribute problems so that you can avoid
them in your model.
Single Attributes Contain Different Data
When we say a single attribute with different data, we are referring to a
scenario in which you create attributes named attribute1, attribute2, at-
tribute3, and so on. That is, you add several columns with similar names
and data types in order to hold some nonspecific information. Mountain
View needs to store information about its products—musical instruments
and their related accoutrements. This presents a bit of a modeling prob-
lem. The products need to be stored in a Products table so that they can
be tied to orders and inventory can be tracked, but different types of in-
struments are very different. Clarinets do not have strings, and guitars
don't have mouthpieces. This scenario leads us to create a products table
having the generic attribute columns shown in Figure 8.6.
This table was built this way so that each instrument could have at-
tributes that are unique to it. For example, a guitar needs to store the type
of wood for the neck, the type of wood for the body, the tuner style, the
number of strings, the metal the frets are constructed from, and the finish.
In contrast, for a saxophone we need to store the type of metal, the horn's
key, the type of material used for the pads, the width of the bell, and the
type of finger pads.
 
 
Search WWH ::




Custom Search