Kirzilla
Kirzilla

Reputation: 16606

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.

Upvotes: 8

Views: 3141

Answers (5)

Yordan Georgiev
Yordan Georgiev

Reputation: 5460

Depends on the logical relations , for example:

  • Article_Author
  • Links , UserRoles -> LinksForUserRoles / Links_For_UserRoles
  • User , Role - > UserRole

Upvotes: 0

rosscj2533
rosscj2533

Reputation: 9323

I'd use AuthorArticle. Generally the 'primary' object should go first (if one can be determined), but the ordering is not a big deal.

Upvotes: 2

chris
chris

Reputation: 37480

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

Upvotes: 3

Rufinus
Rufinus

Reputation: 30773

1) article_has_author (just my "privat" convention)m or ArticleAuthor 2) in n:m relations it normaly doesnt matter.

Upvotes: 1

Anton Gogolev
Anton Gogolev

Reputation: 115857

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.

Upvotes: 7

Related Questions