数据库命名规范参考二(道听途说·简略版)

2018-09-28  本文已影响0人  麒麟楚庄王

每一种编程语言都有自己的命名规范,就MySQL来说,除了官网关于identifier的说明,目前我还没发现每个人都遵守的普适性的代码规范。

1. 命名习惯版本一

a. 见词知义

表名举例:用户表users 商品表products 书籍表books

字段名示例:books表中的字段名 b_id、b_name、b_price

products表中的字段名 p_id、p_number

b.不可太长,最好不要超过三个英文单词

c.多模块加前缀,特别是数据表名、存储过程名、事务名、触发器名等等,例如 U_Role、U_Group

2. 命名习惯版本二

Use lowercase:Will help on speed typing, avoid mistakes dues to case sensitivity e.t.c

No space – use underscore instead

No numbers in name only alpha English characters

Valid understandable names like  blog, ecommerce e.t.c but not like project, james, e.t.c

Name should be self explanatory

Names should not be more than 64 characters.

Avoid prefix

上一篇 下一篇

猜你喜欢

热点阅读