I have a 4 types of users and each have specific data, but they also share commun data, like username
, password
..
My first thought is to create a main users
table with user_type
column. Then when querying user data i can just first select their user_type
and then depending on the output
run a different query to grab "user type" specific data.
I am not fond of this as i wish i could grab all user related data with one query and ideally using Foreign Keys.
Second idea is to not have a user_type
column in the users
table and instead use foreign key that from a specific user type table will point to a row the main users
table.
I like that a bit better though i guess i will have to run N queries, where N is the number of user type every time i need to grab user data.
Are there any other options ? What would be the good practice in such a case ?
Many thanks