Database Reference
In-Depth Information
Figure 8.11. The CUSTOMERS table with the new artificial candidate key,
C USTOMER ID
Nowyou'll repeat this procedure foreach table inthe database. Remember tomake certain
that every table has at least one candidate key.
The next order of business is to establish a primary key for each table. As you know, you
select the primary key for a particular table from the table's pool of available candidate
keys.Hereareafewpointstokeepinmindwhenyou'rechoosingaprimarykeyforatable
with more than one candidate key.
• Choose a simple (single-field) candidate key over a composite candidate key.
• If possible, pick a candidate key that has the table name incorporated into its own
name.
• Select the candidate key that best identifies the subject of the table or is most
meaningful to everyone in the organization.
You begin by working with the EMPLOYEES table in Figure 8.12 . As you review the
candidate keys, you decide that E MPLOYEE N UMBER is a much better choice for a primary
key than the combination of E MP F IRST N AME and E MP L AST N AME because Mike's employ-
Search WWH ::




Custom Search