[英]How to create DB tables in this case?
I have created a table called "users" which is having 我创建了一个名为“用户”的表
so now scenario is each user can have n-number of categories which mean userID=1 may have category1, category2, category3 so on and again each categories may have n-number of sub categories. 因此,现在的场景是每个用户可以具有n个类别,这意味着userID = 1可以具有category1,category2,category3,依此类推,每个类别又可以具有n个子类别。 So how can I design my tables?
那么如何设计我的桌子呢? Any suggestions ?
有什么建议么 ?
Simple, the proposed DB Design could be like the following 很简单,建议的数据库设计可能如下所示
1. tbl_users(uid, uname, password, Name, ...)
2. tbl_categories(cid, cname, parent_category_id ...) -- self join
3. tbl_user_categories (uid, cid) -- Mapping table
Some Notes: 一些注意事项:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.