开发者

Naming N:N connectivity tables

开发者 https://www.devze.com 2022-12-20 13:01 出处:网络
We have 2 object types and want to connect them N:N. For example, articles & authors. How would you name relations table?

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 b开发者_开发知识库ooks2authors)

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

Thank you.


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.


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


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


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


Depends on the logical relations , for example:

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

精彩评论

暂无评论...
验证码 换一张
取 消