+ 1
Most efficient way of storing user preferences?
I'm creating a website that has an account system, and I was wondering if it was better to insert the user preference data into the same table as the login information or to create a separate table that links them to the other login table by using the associated ids. For example if a user has an id of 1 than their preference would be stored on another table with an id of 1.
1 ответ
+ 1
I would put the preferences in a separate table, with the user ID as foreign key.
Maybe later you will want to have multiple preferences for the same user. That's why it is a good practice from database design point to separate data into self contained logical units.
See also:
https://en.m.wikipedia.org/wiki/Database_normalization