Standard Implementation of a Users Database – Best Practices

database-design

I need to implement basic personalized user functionality for my website. Is there a standard structure for databases of this type? Like is it common practice to have all user info and data in a single table with each user having his own row, or should this info be split among different tables and linked together (maybe for efficiency?) I'm not tremendously concerned with security at this point, but I'll obviously want to have password encryption before too long.

I tried to find what I was looking for on google, but to no avail. Just let me know if the question needs further clarification or anything.

Best Answer

I suggest that you use typical normalization standards. One user per row.

  • User ID (incrementing bigint)
  • User Common Name (to be displayed on the site)
  • User Email Address
  • Password Salt (Unique for every user, inserted when the account is created)
  • Password (Hashed with the salt - MD5 or SHA1, your preference)
  • Date Account Was Created

The rest is up to you given your business rules.