Relational database design question - Surrogate-key or Natural-key?

前端 未结 10 2158
忘了有多久
忘了有多久 2020-11-27 22:33

Which one is the best practice and Why?

a) Type Table, Surrogate/Artificial Key

Foreign key is from user.type to type.i

10条回答
  •  忘掉有多难
    2020-11-27 23:34

    If typeName is a natural key, then it's probably the preferable option, because it won't require a join to get the value.

    You should only really use a surrogate key (id) when the name is likely to change.

提交回复
热议问题