Skip to content

Unique key

A unique key constrains values or combinations so they cannot occur more than once within the defined data scope.

Software Development

Choose the right uniqueness boundary

A unique key or corresponding uniqueness constraint prevents duplicate values in selected columns or their combination. In a fictional example, the combination of tenant, an isolated customer context, and product code must be unique. The same code may then occur in a different tenant, but not again within the same tenant.

Choosing the right boundary matters. Clarify comparison rules such as case sensitivity and the treatment of missing values (NULL). These depend on database-system behaviour and settings. Technical uniqueness does not prove that different records cannot describe the same real company. It therefore replaces neither business duplicate review nor access control.

Sources

Articles on this topic

Software Development with ASES

Custom software, web and mobile apps