What are some common and useful fields for a users table in a database

database-design

I want to begin implementing user functionality on my website, but I'm not sure exactly what kind of information I should be storing. Obviously the basic things like username, password, password hash, real name, email, etc…, but what are some other things that might be useful to know about the user, in a general sense? (I've been tossing around things like last login, login location)

Best Answer

This is what I recommend for absolute, must-have fields in a users table:

Is there a standard implementation of a Users Database?

Things like last login, login location, login IP, etc. are better served in a historical table where you can run inserts and then query against the table if you need information. The idea is to have infrequent updates in a heavily used table, like users. Purge old records as necessary.