Why Keys Are Important
Keys are crucial to a table structure for the following reasons:
- They ensure that each record in a table is precisely identified.
A table represents a singular collection of similar objects or events.
(For example, a CLASSES table represents a collection of classes,
not just a single class.) The complete set of records within the table
constitutes the collection, and each record represents a unique instance
of the table's subject within that collection. You must have some means
of accurately identifying each instance, and a key is the device that
allows you to do so.
- They help establish and enforce various types of integrity.
Keys are a major component of table-level integrity and
relationship-level integrity. For instance, they enable you to ensure
that a table has unique records and that the fields you use to establish
a relationship between a pair of tables always contain matching values.
- They serve to establish table relationships. As you'll learn
in Chapter 10, you'll use keys to establish a relationship between a
pair of tables.
Always make certain that you define the appropriate keys for each
table. Doing so will help you guarantee that the table structures are
sound, that redundant data within each table is minimal, and that the
relationships between tables are solid.