SQL Join Table Naming Convention

前端 未结 18 1775
面向向阳花
面向向阳花 2020-12-08 04:01

I have 2 tables: Users and Roles, and I have a table that joins these together. The only thing in the join table is Ids that link the 2 tables.

What should I call th

18条回答
  •  情话喂你
    2020-12-08 04:13

    I've been thinking carefully about this, and I would link the table User and the table Role with the table UsersRoles. I think its nice, because it indicates that the many-to-many relationship could be considered as linking many roles to one user, or indeed many users to one role (so both being plural makes sense). It can also be read as "Users' roles", indicating that the normal way of thinking about the relationship is the "roles that a user has" way round.

提交回复
热议问题