数据库模式中的多对多关系表是否有正式名称?
我参与过的大多数项目都需要数据库模式中的多对多关系。例如,您可能有“用户”和“组”的概念,并且数据库可能包含一个“用户”表、一个“组”表和一个将两者关联起来的“用户组”表。
我对该示例中 UserGroup 表的概念名称感兴趣。
我已经习惯称它们为“秋千桌”,因为我就是这样学会的,但我已经有一段时间没有听到其他人使用这个术语了。
相反,我听说过以下所有内容(包括一些新的,谢谢大家!):
- 关联表
- 桥接表
- 交叉引用表
- Gerund(EF Codd,关系模型的创建者,可能更喜欢这个)
- 交集表
- 连接表(Google 上的大多数搜索结果...参见下面的答案)
- 连接表(维基百科偏爱这个)
- 链接表 ( Fowler 喜欢这个)
- 多对多关系表
- 映射表 参考
- 表
- 关系表
- Swing 表
这种表有官方名称吗?有来源来支持其官方性吗?
Most of the projects I've worked on have required many-to-many relationships in the database schema. For example, you might have the concept of Users and Groups, and the database might contain a table User, a table Group, and a table UserGroup to relate the two.
I'm interested in the conceptual name of the UserGroup table in that example.
I've grown accustomed to calling them "swing tables" because that's how I learned it, but I haven't heard other people use that term in a while.
Instead, I've heard all of the following (including some new ones, thanks to all of you!):
- Association table
- Bridge table
- Cross-reference table
- Gerund (E.F. Codd, creator of the relational model, may prefer this)
- Intersection tables
- Join table (most search results on Google...see answer below)
- Junction table (Wikipedia favors this one)
- Link table (Fowler likes this one)
- Many-to-many relationship tables
- Map table
- Reference table
- Relationship table
- Swing table
Is there an official name for this kind of table, with a source to back its official-ness?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
我称之为交叉引用表。
有些人可能不认为这是一个官方术语,但它确实是一个流行的术语。我的意思是,如果您搜索它。我喜欢的另一件事是它可以很容易地缩写为“xref”,然后在表命名方案中使用,例如“table1_xref_table2”。这会让团队中的每个人都称其为同一件事。
更新:
维基百科将其称为连接表。奇怪的是我从来没有听说过这个词,但我想不同的圈子对它有不同的称呼。正如我们所发现的——没有单一的官方答案。
2023 年更新:
维基百科现在将连接表重定向到“关联实体”。该页面目前似乎更喜欢术语“关联表”。该页面上给出了一长串术语:
I call it a cross-reference table.
Some may not consider this an official term, but it's certainly a popular one. I mean, you'll find plenty of relevant results in Google if you search for it. The other thing I like is that it can be easily abbreviated "xref" and then used in your table naming scheme, e.g. "table1_xref_table2". That'll get everyone on your team calling it the same thing.
UPDATE:
Wikipedia calls it a junction table. It's strange that I've never heard that term but I suppose different circles call it different things. As we're finding out -- there is no single official answer.
UPDATE in 2023:
Wikipedia now redirects junction table to "associative entity". That page currently seems to prefer the term associative table. There is a long list of terms given on that page:
在我看来,最常见的名称是“Join Table”,但我听说过您列出的其他几个名称。所以,我会说“不”,没有“官方”名称:-)
The most common name is "Join Table" in my opinion, but I have heard several others you have listed. So, I would say "no", there is no "official" name :-)
这是非常不科学的,但我认为看看有多少谷歌结果与这个问题的常见答案和术语“多对多”的组合相关联会很有趣。
基于此,看起来“连接表”是...嗯...多对多关系中连接表最常用的术语。
组合搜索词
在 Google 中返回大约 13,700 个结果。
返回 4,700 左右。
返回 3,500 左右。
返回 3,300 左右。
返回 3,200 左右。
返回 1,500 左右。
返回 1,000。
仅返回 450。
This is HIGHLY unscientific, but I thought it would be interesting to see how many Google results were associated with the combination of common answers to this question and the term "many to many".
Based on this, it looks like "join table" is the most commonly used term for the...um...joining table in a many-to-many relationship.
The combined search terms
return around 13,700 results in Google.
returns around 4,700.
returns around 3,500.
returns around 3,300.
returns around 3,200.
returns around 1,500.
brings back 1,000.
only returns 450.
我总是将其称为交集表。
I've always called then intersection tables.
我总是称它们为“多对多表”或“多对多连接表”。似乎最不可能被误解为其他东西。 (我注意到您在问题标题中使用了类似的措辞......)
I always just call them "many-to-many tables", or "many-to-many join tables". Seems the least likely to be misunderstood as something else. (I notice you used similar wording in the title of your question...)
我称它们为链接表,但我已经这样称呼它们太久了,以至于我不知道我从哪里得到这个术语。
I call them link tables, but I've called them that for so long that I have no clue where I got the term from.
我认为关系表更有意义。至少我们使用的是这样的。顺便说一句,如果您要求命名,我们总是以这种方式使用
table1_table2
,无一例外。从长远来看,这会对你有好处。I think Relationship table is more at the mark. At least that is what we use. By the way if you ask for naming we always use it this way
table1_table2
with no exceptions. That will serve you well in the long term.在 Smarties 的 SQL 中有一个部分,Celko 有机会命名这种表:
在本节的顶部,他讨论了 ER(实体关系)图。
There's a section in SQL for Smarties where Celko had an opportunity to name this kind of table:
At the top of the section he talks about E-R (entity-relationship) diagrams.
当然是交叉点表!我相信甲骨文也喜欢“交集”表。
http://download.oracle.com/docs/cd/ B40099_02/books/ConfigApps/ConfigApps_TablesColumns7.html
Intersection table surely! I believe oracle also favor 'Intersection' tables.
http://download.oracle.com/docs/cd/B40099_02/books/ConfigApps/ConfigApps_TablesColumns7.html
当我第一次开始研究关系数据库时(大约 20 年前的 Dec Rdb),我被告知将它们称为“链接实体”。 “实体”位可能来自表所在的实体关系图,尽管“链接表”现在听起来更适合来自同一进化树。
使用 @Noah 在 Google 上的开创性研究,目前可产生约 2000 个参考文献:
I was told to call them 'link entities' when I first started work on relational databases (Dec Rdb almost 20 years ago). The 'entity' bit probably coming from the entity relationship diagrams the tables were in, although 'link tables' now sounds like a better fit from the same evolutionary tree.
Using @Noah's ground breaking research on Google this yields about 2000 references currently: