Forum Moderators: coopster

Message Too Old, No Replies

database design help ?

         

PHPycho

4:09 am on Sep 14, 2008 (gmt 0)

10+ Year Member



Hello forums !

I would like to know the idea regarding db design for the following case:
CASE:
There are three types of users(say Customer, Business User and Personnel)
They have some parts common like first name, last name, email etc. Users like business user and personnel
have login access and permission types.

I would like to know:
1> whether to design three tables for the three types of users with all the required fields.
2> or one table with extra field user_type (for common fields).and other table for login infos and permission types.

Which one is better and why ? I would like to know the opinions of the forumians.

cameraman

7:51 am on Sep 14, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do they do any of the same things, do they visit any of the same pages? If a business user and personnel visit a particular common page, can one do things on that page that the other can't? Is permission type pretty much the only difference between a business user and personnel? If customers don't log in, how do you know their names?

It depends on how different the three entities are. If you've got a bunch of fields of data that you track for one but not the others, it probably deserves its own table. If all three are practically identical except for a permission level and maybe another field or two and all are going to be hitting the same scripts, the scripting will be easier if you're consulting the same table for all, and you can reuse code more - whether it's copy/paste or writing common functions to rehandle the data. As for the customers, they have a permission type, too - a permission of none ;)