What are the down sides of using a composite/compound primary key?

后端 未结 8 2251
说谎
说谎 2020-12-14 20:30

What are the down sides of using a composite/compound primary key?

8条回答
  •  無奈伤痛
    2020-12-14 21:01

    I would recommend a generated primary key in those cases with a unique not null constraint on the natural composite key.

    If you use the natural key as primary then you will most likely have to reference both values in foreign key references to make sure you are identifying the correct record.

提交回复
热议问题