开发者

Having a Login ID and a PersonID in SQL

I am creating an application that will require a user to register and create an account.

Should I use the person's Login ID (this is the email address) as the unique record identifier or should I also create a PersonID (or rec_id).

Why should I (or s开发者_StackOverflow中文版hould not) create a rec_id ?


If you use the email address as a primary key in the Person table and foreign key in the related tables, it will be hard to implement the Change Email feature - instead of a single update, you will be forced to add a new record to the Person, update all the related records and then delete the record with old email.


Of course the person's mail address usually should be unique. But an additional record ID can be used as foreign key in other tables and so will make table joining much easier.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜