简体   繁体   中英

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.

在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM