Availability of login id and user id in SQL

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

Should I use a user login ID (this is an email address) as a unique identifier for the entry, or do I also need to create a PersonID (or rec_id).

Why should I (or should not) create rec_id?

+5
source share
2 answers

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

+4
source

Of course, a person’s mailing address should usually be unique. But the additional record identifier can be used as a foreign key in other tables, so it will greatly simplify the join of the table.

+3
source

All Articles