Surrogatnyckel
Surrogatnyckel, in Swedish database terminology, refers to the concept known in English as a surrogate key. It is an artificial unique identifier used as the primary key in a relational database table. It has no intrinsic meaning to users and is typically generated by the database, such as an auto-incrementing integer or a globally unique identifier (GUID/UUID). Its main role is to serve as a stable, simple, and efficient identifier for records, decoupled from the actual business data stored in the table.
Properties: a surrogatnyckel is unique and immutable (usually not updated), and is not derived from business
Advantages: it improves key stability when business identifiers may change; it avoids issues with composite keys
Common implementations: numeric auto-increment (IDENTITY), sequences, or fixed-length UUIDs. In some designs, a surrogatnyckel is the
Trade-offs: introduces an extra column and a potential need to maintain additional business keys or constraints;
Usage considerations: typically recommended when natural keys are large, composite, or subject to change, or when