mysql - 问个数据库的设计规范,中间表名应该用单数还是复数?
巴扎黑
巴扎黑 2017-04-17 15:04:41
0
4
931

问个数据库的设计规范问题,假设有个用户表users 有个角色表roles 用户跟角色之间是多对多关系,那我中间表应该用users_roles 还是用user_role? Laravel 默认是用单数user_role我想知道有什么设计规范?

巴扎黑
巴扎黑

reply all(4)
左手右手慢动作

is usually in the form of merge_user_role or mapping_user_role. Of course, user_role is also possible, but it is easy to be confused with other tables. As for whether to use plural numbers, it mainly depends on the design of other tables. If your users table is plural, you can probably use plural numbers here, but generally table names do not appear in plural form, so there is no need to use plural numbers here.

PHPzhong

There is no need to worry about whether it is singular or plural, just keep the style consistent

PHPzhong

There is no regulation, but it is recommended to use the odd number, because if the negative number takes up 2 more characters, the maximum length of the identifier in ORACLE is 30. In some cases, using the plural number will exceed the limit

伊谢尔伦

The naming convention only needs to be unified. If a single table name uses a plural number, it is also recommended to use a plural number in the name of the table relationship.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template