Primary keys
When we design entities, we choose an attribute or a combination of multiple attributes that can be used to uniquely identify an entity as the primary key of that type of entity.
By nature, primary keys are unique. For example, since two users cannot have the same email address, we could use it as the primary key of the User entities. However, that won't work in applications that allow users to change their email addresses. The attribute or a combination of the attributes that are used as the primary key must be stable. That is, the value of a primary key must not be changed throughout the life cycle of that entity, for the same reason that it is not a good idea to use an attribute username as the primary key for the User entities. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access