开发者

MySQL Table inside Table or Alternative

开发者 https://www.devze.com 2023-02-07 17:04 出处:网络
A system I am making has Table Users, wherein each us开发者_Python百科er has his/her own userid.

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

精彩评论

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

关注公众号