Database Reference
In-Depth Information
election, and select one of them to become the official primary key of the table. You've
already identified the candidates, so now it's election time!
Assuming that there is no other marginal preference, here are a couple of guidelines you
can use to select an appropriate primary key.
1. If you have a simple (single-field) candidate key and a composite candidate key,
choose the simple candidate key. It's always best to use a candidate key that con-
tains the least number of fields.
2. Choose a candidate key that incorporates part of the table name within its own
name. For example, a candidate key with a name such as S ALES I NVOICE N UMBER
is a good choice for the SALES INVOICES table.
Examine the candidate keys and choose one to serve as the primary key for the table. The
choice is largely arbitrary—you can choose the one that you believe most accurately iden-
tifies the table's subject or the one that is the most meaningful to everyone in the organiza-
tion. For example, consider the EMPLOYEES table again in Figure 8.5 .
Search WWH ::




Custom Search