Primary+keys

I had trouble understanding them so hope this helps.
 * Today I will teach you how to make primary keys and the importance of primary keys:**

Primary keys
A table can only have one primary key. A primary key is a field or set of fields that: You can add the primary key from one table to another table to create a relationship between them. In the other table, it is called a foreign key. For example, suppose you use the primary key of the Customers table in the Orders table. In the Orders table it is a foreign key. Primary key Foreign key
 * Has a unique value for each record
 * Is indexed
 * Identifies the record

Foreign keys
A foreign key, simply stated, is another table's primary key. The values in a foreign key field match values in the primary key, indicating that the two records are related — for example, a customer and an order that she has placed. Unlike primary keys: You create a foreign key when you use the Lookup Wizard to create a field.
 * A table can have more than one foreign key.
 * A foreign key does not necessarily have unique values.
 * A foreign key cannot reliably identify a particular record. For example, you cannot always tell which record you are viewing from the Orders table by looking at the Customer ID.

Candidate keys
Sometimes a table already contains a good primary key field, such as a serial number or a product code. Such fields are called candidate keys. For example, if you track post-secondary educational outcomes, you might have a Colleges table. Suppose there is an official database of colleges that provides a code number for each college, such as the U.S. Department of Education Integrated Postsecondary Education Data System ([|IPEDS]). You could use the code that system provides as the primary key for your Colleges table. A good candidate key has the following characteristics: An example of a poor choice for a primary key is a customer's name. Although some names are unique, some are not. Because you cannot be sure that values will be unique, names are not candidate keys. When you create a new table in Datasheet view, Access automatically creates a primary key field for you, names the field **ID**, and gives it the AutoNumber data type. The field is hidden by default in Datasheet View, but you can see the field if you switch to Design View.
 * Each value is unique. No two records in the table have the same value for the key.
 * It is never empty or null — it always contains a value.
 * Once established, each value is relatively permanent. Ideally, the values in the key field never change — they only get added or removed.

AutoNumber fields
If your table doesn't have any good candidate keys and you didn't create the table in Datasheet view, consider adding a field that has the AutoNumber data type, and then using that field for the primary key. An AutoNumber field automatically gets a new, unique value for each record that is added. Even if you delete records, the values are not reused. An AutoNumber therefore produces unique values for each record, and makes a good primary key.

A column with the AutoNumber data type often makes a good primary key, because it ensures that no two Product IDs are the same.

Composite keys
In some cases, you want to use two or more fields in combination as the primary key for a table. For example, an Order Details table that stores line items for orders might use two fields in its primary key: Order ID and Product ID. A key that has more than one field is called a composite key. [|Top of Page] 
 * Note** You cannot create a composite foreign key by using the Lookup Wizard. You can create a composite foreign key by using a data-definition query to create a multiple-field constraint. For more information, see the topic [|Create or modify tables or indexes by using a data-definition query].

Add an AutoNumber primary key
A key indicator appears to the left of the AutoNumber field. Press CTRL+S to save your table design changes. [|Top of Page] 
 * 1) In the Navigation Pane, right-click the table to which you want to add a primary key and then click **Design View** on the shortcut menu.
 * 2) In the first empty row of the table design grid, in the **Field Name** column, type a name, such as **CustomerID**.
 * 3) In the **Data Type** column, click the drop-down arrow and then click **AutoNumber**.
 * 4) Under **Field Properties**, in **New Values**, click **Increment** to use incremental numeric values for the primary key, or click **Random** to use random numbers.
 * 5) On the **Design** tab, in the **Tools** group, click **Primary Key**.[[image:http://office.microsoft.com/global/images/default.aspx?AssetID=ZA101787811033 caption="Ribbon Design Tab Tools Group"]]

Specify fields to use as the primary key

 * 1) In the Navigation Pane, right-click the table for which you want to set the primary key and then click **Design View** on the shortcut menu.
 * 2) Select the field or fields that you want to use as the primary key.

A key indicator appears to the left of the field or fields that you specify as the primary key. Press CTRL+S to save your table design changes. David Iny info273 info taken from office.microsoft.com
 * Tip** To select more than one field, hold down CTRL while you click the fields.
 * 1) On the **Design** tab, in the **Tools** group, click **Primary Key**.[[image:http://office.microsoft.com/global/images/default.aspx?AssetID=ZA101787811033 caption="Ribbon Design Tab Tools Group"]]