Reputation: 2799
I'm designing the database for one of my projects, and we have two types of users, a normal user (default), and a bushiness user, they have identical attributes but differ on abilities, for instance.
A business user can post a job, whereas the normal user can only apply to jobs and nothing more, which one is the preferred way of doing so.
Method 1
Define two different tables: will cost storage space since both users have identical attributes
or
Method 2
Having a boolean flag to determine the type of user ex is_business_account
attribute, which might bloat the code with if, else conditions.
This can be solved with roles but do i need to define such table for roles or ?
Thank you for your time
Upvotes: 1
Views: 315
Reputation: 46
When creating entities, you don't want to have multiple entities that are really the same. In your case, you have Users as an entity (table) and one of the attributes is whether or not they are a business user. As part of your program, when the user signs in, you check the user against 1 table to log in and which set of functions to display.
Upvotes: 3