I have users who can login on a front-end page, and admins who can login on an admin page.
Should both users and admins be "Users" with different roles, or should they be split in different tables?
A good database design is, therefore, one that: Divides your information into subject-based tables to reduce redundant data. Provides Access with the information it requires to join the information in the tables together as needed.
Answer and Explanation: Storing all data in one single table will be confusing, may have security issues and there will be duplication in recording.
Roles should be tracked separately from user accounts, because someone can be promoted (or demoted) over time. Would it make sense in that situation to have two different user accounts, in two different tables? I think not.
Here's the basic structure I'd use -
Yes, all users belong in the users table. You also need to have a Roles table and have a FK betweent the two.
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