which one is better, defining two tables, or having a boolean flag to determine the type of a user

so im 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 preffered way of doing so

method 1

defining two different table: will cost storage space since both users have identical attributes


method 2

having a boolean flag to determine the type of user ex is_buissness_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

Add Comment
1 Answer(s)

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.

Answered on September 1, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.