Go Back   Forum Care Forums > Development Reference Area > MySQL Discussion

Reply
 
LinkBack Thread Tools Display Modes
Re: Modeling Group Membership
Old
  (#1)
Guest
Guest
 
Posts: n/a
Default Re: Modeling Group Membership - 06-04-2007, 07:58 AM

On May 23, 12:34 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> pietro...@gmail.com wrote:
> > Suppose I have records modeling users. Each user can be a member of
> > any number of groups (like how a unix user can be a member of any
> > number of groups). Whats the best way to implement this?

>
> > I think I would prefer if it was possible to have an enum field in the
> > user table which could store multiple values per record (one per
> > group) but the only practical way I can think to do it is to create
> > tables for each group and store the users primary key in the tables
> > corresponding to their group membership.

>
> > Following me? Any better ideas?

>
> Google for "database normalization" - it should help.
>
> You need a table which contains two columns - a group id and a user id.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================


They would form a joint primary key then. Does that mean that
selecting All users in a group and All groups of a user would be
equally efficient?

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top