SQL: Do you need an auto-incremental primary key for Many-Many tables?

后端 未结 7 991
半阙折子戏
半阙折子戏 2020-12-06 00:48

Say you have a Many-Many table between Artists and Fans. When it comes to designing the table, do you design the table like such:

ArtistFans
    ArtistFanID         


        
7条回答
  •  粉色の甜心
    2020-12-06 01:37

    The standard way is to use the composite primary key. Adding in a separate autoincrement key is just creating a substitute that is already there using what you have. Proper database normalization patterns would look down on using the autoincrement.

提交回复
热议问题