The purpose of keys in a database is to enforce unique values in an entity and provide a means of sorting the tables to access entity data faster.
In a relational database, there are four types of keys:
● Primary Key: A primary key or unique key is a candidate key to uniquely identify each row in a table. A primary key comprises a single column or set of columns where no two distinct rows in a table can have the same value (or combination of values) in those columns. Depending on its design, a table can have many unique keys but at most one primary key. A unique key must uniquely identify all possible rows that exist in a table and not only the currently existing rows, such as social security numbers. A primary key is a special case of a unique key in that for unique keys the implicit NOT NULL constraint is not automatically enforced, while for primary keys it is. The values in a unique key column may or may not be NULL. Unique keys as well as primary keys can be referenced by foreign keys.
● Alternate Key: Alternate keys are the equivalent to unique index or unique constraints in the physical model. You can enforce alternate keys with unique indexes or unique constraints, depending on the database platform
● Inversion Entry: An attribute or set of attributes that does not uniquely identify every instance of an entity, but which are frequently used for access. The database implementation of an inversion entry is a non unique index.
● Foreign Key: A primary key or non-key attribute that is inherited from another entity.
ER/Studio DA can reverse-engineer key definitions that are not primary key or unique constraints, from a database. You can create primary, inversion, or alternate keys using the Key Editor, which is accessible from the Entity Editor.
For more information, see the following: