Kevin Brown
Kevin Brown

Reputation: 12650

Databases: User Profiles

Is it a bad idea to include all user information in one table? Would it be a good idea to have a users table and a user_profiles table?

Which method is best and why?

Under what circumstances would you employ one/two table(s)?

Upvotes: 1

Views: 156

Answers (3)

Alex Aza
Alex Aza

Reputation: 78457

If the relation between those tables is one-to-one I would have one table. If the relation is one-to-many (one user can have more than one profile) then these obviously should be split.

Another reason to split the tables could be permissions management - it is easier for DBA to restrict permissions to one table and grant to another. I would still have one table with restricted permissions and a public view with limited columns.

I inherited a system where those two tables are split without a good reason for it. It is a pain in the neck to join those tables always. In the end you end up with having a view and asking yourself why the split was made in the first place.

Upvotes: 3

Snowy Coder Girl
Snowy Coder Girl

Reputation: 5518

I agree with Summer. I don't see any issue in having all of the information in the same table.

The benefit to having it all in one table is that you won't have to do joins, etc when running database queries. Which means your application would run faster.

Upvotes: 0

user812893
user812893

Reputation:

I usually have a person table and a user table. The users table holds all of the user information (username, password (encrypted), etc). The person table holds names, etc.

Upvotes: 1

Related Questions