Use item specific prefixes and autonumber for primary keys?

后端 未结 9 1456
孤街浪徒
孤街浪徒 2020-12-05 20:12

We had a meeting this morning about how would should store our ID for some assets that we have in our database that we are making, the descusion generated a bit of heat so I

9条回答
  •  春和景丽
    2020-12-05 20:38

    Well, I want to make some points and suggestions,

    • Consider having a separate table for Type, say with the column Id and Desc, then make a foreign key TypeId in this table. One step further in order to normalize the thing. But it may not desirable. Do it if you think it serve some purpose

    • Making it String does make sense, if later you folks think of shifting towards UUID. You don't need to change the data-type then

    [Edited]

    I agree with Cletus here. That surrogate key proved to be beneficial in some real life projects. They allow change, and you know well that, change is the only constant.

提交回复
热议问题