Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this questionI'm looking for document (suggestions) with column name standards or conventions for MySQL. Can anybody suggest any?
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_ 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
Naming conventions comes into play when using frameworks like Ruby on Rails or Zend that subscribe to convention over configuration. Anything that will scaffold forms for you or "auto discover" your database. Looking at these conventions could also help you decide on a naming strategy even if you are not using a framework.
精彩评论