Database Reference
In-Depth Information
8. Keys
A fact in itself is nothing. It is valuable only for the idea attached to it, or for the
proof which it furnishes.
—C LAUDE B ERNARD
Topics Covered in This Chapter
Why Keys Are Important
Establishing Keys for Each Table
Table-Level Integrity
Reviewing the Initial Table Structures
Case Study
Summary
Review Questions
By now you've identified all the subjects that the database will track and defined the table
structures that will represent those subjects. Furthermore, you've put the structures through
a screening process to control their makeup and quality. In this next stage of the database
design process, you'll begin the task of assigning keys to each table. You'll soon learn that
there are different types of keys, and each plays a particular role within the database struc-
ture. All but one key is assigned during this stage; you'll assign the remaining key later (in
Chapter 10 , Table Relationships ) as you establish relationships between tables.
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. As you already know,
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 com-
plete set of records within the table constitutes the collection, and each record rep-
resents 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 al-
lows you to do so.
They help establish and enforce various types of integrity. Keys are a major com-
ponent of table-level integrity and relationship-level integrity. For instance, they en-
Search WWH ::




Custom Search