Key Type

Type of key. Valid types are Primary, Candidate, or Index.

Value

Description

Primary

Uniquely identifies each occurrence of the entity. Each entity has only one primary key, which must be the first key defined.

Candidate

Uniquely identifies each occurrence of the entity. An entity can have more than one candidate key when there is more than one field or combination of field that uniquely identifies each occurrence of the entity.

Index

Identifies a field for which the DBMS must maintain an index. Index keys are not necessarily unique. They can improve performance when searching for the required occurrences, but can decrease performance when occurrences are created or removed. An index is automatically created for the primary and candidate keys.

Description

If there is no field that can uniquely identify each occurrence of the entity, use a collection of fields as a compound primary or candidate key.

By definition, the combination of all the fields in an entity can also be a candidate key because each occurrence of an entity must be unique. You can use a candidate key as the foreign key when defining a relationship. However, use the primary key if possible. This is recommended because Uniface does not perform the default data integrity checks when a relationship is defined using a candidate key.

The $keytype function can be used to get a key's type in ProcScript.

Applies To

Related Topics