Is there an official name for the many-to-many rel

2019-01-17 21:12发布

问题:

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?

回答1:

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 :-)



回答2:

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.



回答3:

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

"join table" "many to many"

return around 13,700 results in Google.

"link table" "many to many"

returns around 4,700.

"junction table" "many to many"

returns around 3,500.

"association table" "many to many"

returns around 3,300.

"relationship table" "many to many"

returns around 3,200.

"intersection table" "many to many"

returns around 1,500.

"cross-reference table" "many to many"

brings back 1,000.

gerund "many to many"

only returns 450.



回答4:

I've always called then intersection tables.



回答5:

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.



回答6:

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.



回答7:

There's a section in SQL for Smarties where Celko had an opportunity to name this kind of table:

Tables that represent many-to-many relationships should be named by their contents, and should be as minimal as possible. For example, Students are related to Classes by a third (relationship) table for their attendence. These tables might represent a pure relationship, or (etc)...

At the top of the section he talks about E-R (entity-relationship) diagrams.



回答8:

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...)



回答9:

Intersection table surely! I believe oracle also favor 'Intersection' tables.

http://download.oracle.com/docs/cd/B40099_02/books/ConfigApps/ConfigApps_TablesColumns7.html



回答10:

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:

"link entity" "many to many"