Composite Primary key vs additional “ID” column?

后端 未结 4 1036
伪装坚强ぢ
伪装坚强ぢ 2020-11-30 00:24

If we had a table like this:

Books (pretend \"ISBN\" doesn\'t exist)

  • Author
  • Title
  • Edition
  • Year of publication
  • Price
4条回答
  •  旧巷少年郎
    2020-11-30 00:50

    Another good reason for using the surrogate primary key scenario is if the uniqueness constraint should change in the future (say, ISBN needs to be added to make a book unique). Rekeying your data will be much easier.

提交回复
热议问题