Darshan Patel
Darshan Patel

Reputation: 2897

Database design for three completely different profiles

I have question regarding database design for three completely different profiles which have only common columns are user_id and password.

Let's say I have profile tables and its columns like,

Profile1 : user_id, password, profile1_col1, profile1_col2, ...

Profile2 : user_id, password, profile2_col1, profile2_col2, ...

Profile3 : user_id, password, profile3_col1, profile3_col2, ...

So, how can I normalize these tables so that I can make a common login module for these profiles?

Note : I didn't give proper column names because right now I don't have any similar requirement.

Upvotes: 0

Views: 201

Answers (1)

Mohsen Heydari
Mohsen Heydari

Reputation: 7284

enter image description here

You may use inheritance.
Defining a new entity as the base table for (profile-type-one, profile-type-two,...) to satisfy login-able.
May naming it abstract-profile will be rational.
Having a zero-or-one relation will cause primary key of this abstract-profile table being the primary key of (profile-type-one, profile-type-two,...).

Other tables like login-history, user-action-trace ... will have a relation to this base table.

Upvotes: 2

Related Questions