Primary and Candidate Keys
In relational databases, each entity must have a primary key—a field or collection of fields with a value that uniquely identifies an occurrence of an entity.
For example, the primary key of the entity TRACK might be the TRACK_CD field. This implies that two tracks may not have the same value for the TRACK_CD field.
Uniface does not allow the user to modify data in primary key fields.
Candidate Keys
A candidate key is any field, or collection of fields, which uniquely identifies an occurrence of an entity. (Thus, a primary key is also a candidate key.)
Entities can have more than one candidate key, since there is often more than one unique field in an entity. In many cases, a single field will not be unique, and only a collection of fields together form the unique element (known as a compound candidate key).
Candidate keys may only contain unique data in the database. The reason for defining a candidate key is to enforce a unique property for a field or collection of fields. For example, a hypothetical TRACK entity may have two candidate keys: TRACK_CD (the primary key), and COUNTRY_CD, TRACK_NAME (a compound candidate key).
Database Support
The databases supported by Uniface can impose restrictions on primary and candidate keys. For more information, see Database Integrity Support.