Database Design: Composite key vs one column primary key

前端 未结 8 2302
既然无缘
既然无缘 2021-01-15 02:26

A web application I am working on has encountered an unexpected \'bug\' - The database of the app has two tables (among many others) called \'States\' and \'Cities\'.

<
8条回答
  •  余生分开走
    2021-01-15 02:39

    Imtroduce a surrogate key. What are you going to do when area codes change numbets or get split? Using business keys as a primary key almost always is a mistake.

    Your above summary is another example of why.

提交回复
热议问题