Currently I store the user's "FirstName" and "LastName" in the USER table, but i also have a USER PROFILE table (which provides additional information about the user) and it would makes sense to have the user's "FirstName" and "LastName" in the USER PROFILE table aswell.
So what do i do? make two copies of "FirstName" and "LastName"?
USER table, contains the user's credentials that the user use to login to his account control panel ie Username, password, registration date, security questions, etc
USER_PROFILE table, contains information about the user, such as Address, Phone Number, country of birth, country of citizenship etc
USER 1.* USER_PROFILE
Put the first name and last name in with the user profile unless they are needed as part of the login procedure. That way there is less data to process, and they belong there more than with account information. Only leave them with login data if they are needed and it will speed up the querying.
As others have said, don't duplicate the data. You can just join the tables when you need it. You should have a primary key on your user table (preferably not the username, they can change) which is referenced from the user profile table. If you don't, add one now before you even think about doing anything else.
No, dont make 2 copies. Either leave it in the USER table, or move it to the USERPROFILE table.
If you have a userid in both you can use a join.
If you can provide a little more structure detail between USER and USERPROFILE we can make a quess as to in which one this belongs. From what I can think, it would seem that the USERPROFILE is the users personal details, so this might seem like the logical place to put the mentioned information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With