Should each and every table have a primary key?

后端 未结 15 1063
甜味超标
甜味超标 2020-11-22 07:00

I\'m creating a database table and I don\'t have a logical primary key assigned to it. So, I\'m thinking about leaving it without a primary key, but I\'m feeling a bit guilt

15条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 07:25

    Except for a few very rare cases (possibly a many-to-many relationship table, or a table you temporarily use for bulk-loading huge amounts of data), I would go with the saying:

    If it doesn't have a primary key, it's not a table!

    Marc

提交回复
热议问题