Primary Key
A primary key is the field or fields in a table that uniquely identifies the record. An everyday example of a primary key is a person's social security number in the United States.
Microsoft® Access, as well as other databases, allow you to identify a field or fields as the primary key. The database then will insure that the field(s) you select are unique and do not contain a null value (missing or unknown data). If you try to enter a duplicate value, an error is generated.
Consider the previous table example:
| First_Name | Last_Name | School | |
| Jane | Doe | A Elementary | jdoe@district.k12.ky.us |
| John | Doe | C High | jdoe2@district.k12.ky.us |
| Joe | Teacher | B Middle | jteacher@district.k12.ky.us |
No single field would be suitable as a primary key, except perhaps the Email field. However, if the Email field were used as the primary key, errors may still be generated. Since the Email field is a text field where user-entry is allowed, user-entry errors are always possible.
The best practice for assigning a primary key in a table is to create an AutoNumber field. The database automatically assigns a new unique number for every new record. In the previous example, the table would be modified to include an AutoNumber field as shown:
| ID | First_Name | Last_Name | School | |
| 1 | Jane | Doe | A Elementary | jdoe@district.k12.ky.us |
| 2 | John | Doe | C High | jdoe2@district.k12.ky.us |
| 3 | Joe | Teacher | B Middle | jteacher@district.k12.ky.us |