SQL Join Table Naming Convention

前端 未结 18 1753
面向向阳花
面向向阳花 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:09

    I'd call the users table User, the roles table Role and the join table UserRoles.

    By the way, the pk Id is not really necessary in a join table. Better make the UserId and RoleId together the pk or just uk (unique key) so that you can ensure unique User-Role relationships.

提交回复
热议问题