Databases Reference
In-Depth Information
key might also include another attribute, such as a date and time stamp, to
ensure unique values. A key that is defined by multiple columns is called a
composite key.
The table based on the associative entity can include additional attributes
representing intersection data. This is shown as the Quantity attribute in this
example. However, this is not a requirement. The associative table often
includes only the data values needed to establish and maintain the many-to-
many relationship.
4.1.3 Converting Unary Relationships
A unary relationship is one that is based on a single table. The problem in this
case is not deciding what tables you need to create, but on how key values can
be used to identify and maintain the relationship.
Converting a One-to-One Unary Relationship
In Figure 4-13 you see a one-to-one unary relationship based on the SALES-
PERSON entity. Each Salesperson has one backup salesperson, someone who
covers when the original salesperson isn't available.
In this case, with only one entity type involved and with a one-to-one rela-
tionship, the conversion requires only one table, as shown in Figure 4-14. For
a particular salesperson, the Backup Number attribute represents the salesperson
number of the backup person. The Backup Number is related to the SALES-
PERSON table's primary key, Salesperson Number. Any value used as Backup
Number must be a valid Salesperson Number.
Figure 4-13
SALESPERSON
Salesperson
Number
Salesperson
Name
Commission
Percentage
Year of Hire
*
Backup
One-to-one unary relationship.
Search WWH ::




Custom Search