Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Naming N:N connectivity tables

We have 2 object types and want to connect them N:N. For example, articles & authors.

  1. How would you name relations table?
  2. What would you put first at table name, articles or authors? (articles2authors or books2authors)

Someone would, probably, recognize this question as stupid. I don't think so because I'm looking for ideal naming convention.

Thank you.

like image 894
Kirzilla Avatar asked Feb 12 '10 16:02

Kirzilla


2 Answers

Choose any

  • Junction Table
  • Cross-Reference Table
  • Bridge Table
  • Join Table
  • Map Table
  • Link Table

, but please do not use '2' to replace 'to', which is so 1970.

I personally prefer Junction: AuthorsArticlesJunction, AuthorsBooksJunction. I put Authors first because without an author neither article, nor book would not exist. This is somewhat metaphysical, but works for me.

like image 168
Anton Gogolev Avatar answered Jan 04 '23 05:01

Anton Gogolev


I prefer map - so something like AUTHOR_ARTICLE_MAP, when used consistently, explains how the table is used.

like image 39
chris Avatar answered Jan 04 '23 05:01

chris