Should I have a dedicated primary key field?

后端 未结 11 1683
温柔的废话
温柔的废话 2020-11-30 10:05

I\'m designing a small SQL database to be used by a web application.

Let\'s say a particular table has a Name field for which no two rows will be allowed to have the

11条回答
  •  孤城傲影
    2020-11-30 10:29

    Yes - and as a rule of thumb, always, for every table.

    You should definitely not use a changeable field as a primary key and in the vast majority of circumstances you don't want to use a field that has any other purpose as a primary key.

    This is basic good practice for db schemas.

提交回复
热议问题