I have a table of Users,
Each USR_ID can have multiple Roles,Views,Brands and Units.
So the optimal design I thought of is this:
Users
USR_ID USR_Username USR_Password
Matrix
M_ID M_USR_ID M_ROLE_ID M_VIEW_ID M_BRAND_ID M_UNIT_ID
_ROLES
ROLE_ID ROLE_Name ROLE_Active
_VIEWS
VIEW_ID VIEW_Name VIEW_Active
_BRANDS
BRAND_ID BRAND_Name BRAND_Active
_UNITS
UNIT_ID UNIT_Name UNIT_Active
So basically in the Matrix table I keep all data regarding which user does what.
My question is, is that the optimal structure and design? further to that, how do the rows in the Matrix table will look like? This is an example of someone that is has ROLE_ID = 1
Matrix
1 30 1 4 7 2 4
Now that I want to add another ROLE to that person, what will the next row look like? Do I keep the values of all other definitions (brand,unit,view...)? Or do I just insert everything with NULL except the ROLE_ID?
Your assistance is much appreciated,
Thanks,