The All-Important Primary Key

graphics/newterm_icon.gif

A primary key is a field or a combination of fields in a table that uniquely identifies each row in the table (for example, CustomerID). The most important index in a table is called the primary key index; it ensures uniqueness of the fields that make up the index and also gives the table a default order. You must set a primary key for the fields on the one side of a one-to-many relationship. To create a primary key index, you select the field(s) you want to establish as the primary key and then click the Primary Key button on the toolbar.

graphics/book_icon.gif

Hour 9, "Creating Your Own Relationships," discusses the details of relationships. In Hour 9, you will also learn about the types of relationships such as one-to-many relationships.


Figure 8.8 shows the tblCustomer table with a primary key index based on the CustomerID field. Notice that the index name of the field designated as the primary key of the table is called PrimaryKey. Note that the Primary and Unique properties for this index are both set to Yes (true).

Figure 8.8. A primary key index based on the CustomerID field.

graphics/08fig08.jpg



    Part III: Creating Your Own Database and Objects
    Part V: Advanced Topics