在数据库设计中的多对多关系 [英] many-to-many relationship in database design

查看:156
本文介绍了在数据库设计中的多对多关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个数据库,有两个表称为文章和标签。为了允许文章在多个类别我有一个多对多的关系。在性能方面有这样的设计是错误的吗?或者应该删除这两个表之间的关系,并添加第三个表作为桥梁(articlesTags)?

I currently have a database with two tables called Articles and Tags . In order to allow articles to be in multiple categories i have a many to many relationship. Is it a mistake to have such a design in terms of performance? or should i remove the relationship between these two table and add a third table as a bridge (articlesTags)?

推荐答案

错误的是有多对多关系,您只需创建一个连接表 (这听起来像是你用 articlesTags 指代),以方便这种关系。

There's nothing inherently wrong with having a many-to-many relationship, you'll just need to create a Junction Table (which is what it sounds like you're referring to with articlesTags) to facilitate that relationship.

这篇关于在数据库设计中的多对多关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆