MySQL – Best Way to Store User Profiles and Logins

loginsMySQLusers

I need to store user profiles and logins. Is the best way to do that to have a table for logins (email, username, and password) and a separate table for their profile/info (e.g. their progress in something)? I am using MySQL if that makes a difference.

Best Answer

In general, if tables relate one-to-one, put both sets of columns in a single table. (There are exceptions, but I don't see one here.)

On the other hand, "progress" sounds like some type of log? That is, there might be lots of rows for each user? Then you must have 2 tables, one with user info, one with 'progress'.

The user table would have a user_id as the PRIMARY KEY and the log table would have an INDEX(user_id, datetime) or something like that. (I am assuming there is a datetime/timestamp column in the log.)