Re: Tabe Relationship

From: Bernard Peek <>
Date: Tue, 11 Mar 2003 15:44:33 +0000
Message-ID: <m4AJBR$hRgb+Ew$>

In message <b4j01h$4rv$>, =?UTF-8?B?IkRhbWphbiBTLiBWdWpub3ZpxIci?= <> writes
>: I wouldn't consider it bad practice to do as outlined below. I would,
>: however, add an indication in the USER table as to what Type of user
>: it is -- an Administrator, a Client, or Staff. Without such a Type
>: field,
>: you're gonna have to check all 3 tables to see which it's in. The Type
>: will point it at a specific table.
>What if USER can be both Administrator and Staff (or any other combination)?

In that case the role is an attribute of a USER. You can implement that in tow different ways.

You could add boolean fields in the USER table, that's simplest if you know for sure how many roles there will be. It's simple but adding a new role could be a pain.

The other way is to create a separate ROLE entity and a link-entity between USER and ROLE. That makes it much easier to add a new role. Following on from what I said in another thread, take a close look at link-entities to see whether they have important attributes. For instance is it desirable to log changes to the roles for security purposes?

Bernard Peek SF & Computing book reviews and more.....

In search of cognoscenti
Received on Tue Mar 11 2003 - 16:44:33 CET

Original text of this message