开发者

MySQL Table inside Table or Alternative

A system I am making has Table Users, wherein each us开发者_Python百科er has his/her own userid.

Each user needs to belong to multiple groups.

Each group can have multiple users.

How would I accomplish this?


Three tables:

USER: - UserID - UserName

GROUP: - Group_ID - Group_Name - Group_Privelages

GROUP_USER: - Group_id - User_id

GROUP_USER would hold the relations of User to group - one user could be in many groups, or one, or none.


Use many-to-many association. Maybe this will help: http://www.tomjewett.com/dbdesign/dbdesign.php?page=manymany.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜