Eroxl's Notes
Primary Key

A primary key is a designated candidate key that is primarily used to identify records.

Example

Consider a table Employee with the following attributes

  • EmployeeID: Unique ID assigned by the company
  • SSN: Social Security Number
  • Name: Name of the employee
  • Department: The department the employee works at

Some examples of it's candidate keys are the following sets:

  • {EmployeeID}: Is unique for every Employee
  • {SSN}: Like the ID is unique for every `Employee

Given this list of candidate keys we can choose the primary key to be either EmployeeID or SSN. Typically we would choose EmployeeID to be our primary key as we would probably be generating it whereas SSN would be entered by the user.