比如:

有4个表user,article,mark,act,许多生手开始时都会这么设计:
user : user_id, act_id, user_name, user_password;
article(文章): article_id, article_content, author_id, article_publicTime;
mark(评论): mark_id, author_id, mark_time, mark_content, article_id;
act(角色): act_id, act_name;
这样显然有问题,表user中会有许多冗余数据.对于user和act的这种多对多的关系,一般都可以拆成一对多的关系,方法就是加一个关系表:

表user : user_id, user_name, user_password;
表act(角色): act_id, act_name;
用户和角色的关系表 user_act:user_id,act_id 

就这么简单。
来自:饮马流花河

相关文章:

  • 2021-09-10
  • 2021-11-19
  • 2022-12-23
  • 2021-09-01
  • 2021-05-26
  • 2022-12-23
  • 2022-01-14
  • 2021-11-19
猜你喜欢
  • 2022-01-16
  • 2021-11-19
  • 2022-01-01
  • 2021-10-18
  • 2022-01-01
  • 2021-11-19
相关资源
相似解决方案