MySQL列名称标准/约定 [英] MySQL column name standards / conventions

查看:76
本文介绍了MySQL列名称标准/约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找具有列名标准或MySQL约定的文档(建议).有人可以建议吗?

I'm looking for document (suggestions) with column name standards or conventions for MySQL. Can anybody suggest any?

推荐答案

与Sun的旧Java约定不同,我知道的这个空间中没有标准".您采用的任何方式都将是个人/公司偏好.

There's nothing "standard" in this space I'm aware of, unlike say Sun's old Java conventions. Anything you adopt will be personal/company preference.

也就是说,我喜欢前缀约定:

That said, I do like prefix conventions:

  • t_表
  • v_查看
  • 索引的idx _
  • 文本字段的tx_
  • 日期字段dt_
  • n_用于数字字段
  • 用于标识字段的id _
  • nm_专门用于名称
  • is_代表布尔值,是否为0/1,是/否,否则
  • fk_作为可选的外键标识符;您最好还是使用id_,以使该字段与其主键对应部分相同,例如id_customer-> id_customer,而不是fk_customer
  • t_ for table
  • v_ for view
  • idx_ for index
  • tx_ for text field
  • dt_ for date field
  • n_ for numeric field
  • id_ for identify field
  • nm_ for something that's specifically a name
  • is_ for booleans, whether 0/1, yes/no or otherwise
  • fk_ as an optional foreign key identifer; you may prefer to stick with id_ though, to keep the field the same as its primary key counterpart, e.g. id_customer -> id_customer, rather than an fk_customer

这篇关于MySQL列名称标准/约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆