Hi,
i think you must normalize your table to more than one table.

Users/Groups  : N:1
Groups/Groups : N:1

Table Users :
User_id
Host
Group_id


Table Groups :
Group_id
Group_parent_id        <- is a another group_id


No data redondancy and robust implementation.

see for example /etc/passwd and /etc/group on a *nix machine.

Mathias

Selon rtroiana <[EMAIL PROTECTED]>:

> Hi All,
>
>
>
> I'm trying to get data from Active Directory and storing in database. So I
> have the following tables with their corresponding primary keys:
>
>
>
> Group               (GroupID)
>
> Host                 (HostID)
>
> User                 (UserID)
>
> GroupMember    (GroupID, MemberID)
>
>
>
> The relations between them according to Active Directory should be as
> follows:
>
>
>
> 1)       Host and user can be in one or more groups
>
> 2)       Groups can be in one or more groups
>
>
>
> I was trying to implement these relations through Db constraints. I wanted
> HostID and UserID should refer to MemberID as Primary Key.
>
>
>
> My problems is a foreign key field cannot refer to a part of primary key, so
>
> 1)       I should add GroupID in Host and User table, which will be
> redundancy of data, or
>
> 2)       Instead of adding a new field, I should not have any relations in
> the database and just implement it in code.
>
>
>
> I have tried with three different designs, but all of them have some issues.
> I tied to add a new table just for Member that would store unique memberID.
> Does it seem like an overhead? I don't if I can just do with existing table
> or not.
>
>
>
> I read some articles online, some of them say it's good to implement
> relations from DB and some say to reduce overhead, relations can be
> implemented from code. What would the best database practice that you would
> suggest?
>
>
>
> I'll appreciate any help
>
>
>
> Thanks,
>
> Reema Duggal Troiana
> Senior Software Developer
> BitArmor Systems, Inc.
> 357 North Craig Street
> Ground Floor
> Pittsburgh, PA 15213
> [TEL] 412-682-2200 Ext 314
> [FAX] 412-682-2201
>
>
>
>



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to