I have to add group functionality to an existing database. The functionality
required will be something like /etc/group in linux. I have a need to create
and maintain a list of groups. Then, each group will have a list of members.
I will need to be able to search by member name and get a list of what
groups the member is in. Also, I will need to maintain the members in each
group (add, delete members).

I would appreciate any suggestions on how best to model this in MySQL. I've
come up with two ideas and I'm not crazy about either.

***************
* The first idea is simple to create a table with two columns:
***************
    groupName            varchar, primary key
    groupMembers       text (comma seperated list)

-----> ex:
    groupOne        member1, member2, member3
    groupTwo       member2, member4

***************
* The second idea is to create two tables.
***************
    table groups
            groupName             varchar primary key
            groupDescription     text

    table groupRelations
          groupName
          groupMember

    -----> ex:
        groups table:
                groupOne            First test group
                groupTwo           Second test group

        groupRelations:
                groupOne            member1
                groupOne            member3
                groupTwo            member2
                groupTwo            member3

Like I said before, I'm not very happy with either method. If anyone else
has any better ideas they wouldn't mind sharing, I'd really appreciate it!

Thanks!





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

Reply via email to