patternMinor
What are some common and useful fields for a users table in a database?
Viewed 0 times
whatarefieldsdatabasesomeusefulforanduserscommon
Problem
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)
Solution
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.
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.
Context
StackExchange Database Administrators Q#3537, answer score: 7
Revisions (0)
No revisions yet.