Saturday, May 1, 2010

Alternate or Secondary Key

0 comments
With respect to relational databases, an alternate key (or secondary key) is any candidate key which is not selected to be the primary key (PK).

For example, a relational database with a table "employee" could have attributes like "employee_id", "national_insurance_number", and so on. In this case, both "employee_id" and "national_insurance_number" serve as unique identifiers for a given employee, and could thus arguably be used for a primary key. Hence, both of them are called "candidate keys". If, for example, "national_insurance_number" was chosen as the primary key, "employee_id" would become the alternate key.

0 comments: