开发者

Style guide for database metadata naming

We want to establish some database metadata naming rules in our new project. For example:

  • tables are named as nouns in a plural form (courses, books, lessons)
  • if present, an adjective goes before a noun in a table name and is separated by an underscore (red_books, new_lessons)
  • table index column is always named id
  • foreign key names are derived from 开发者_运维问答a table name with suffix _id (books_id, red_books_id)
  • so on

Does someone know any guide like this?


There are good links and discussion in this question:

Database, Table and Column Naming Conventions?

You can probably take your pick of the styles there.


that sounds reasonable, so do what works for you. Having a formal standard is the way to go, whatever it is. What works for you and your database is not necessarily what will work for someone else. For example, if I have 8,000+ tables, then I will have a different way to name them, possibly prefix them with a module/area, etc. should you follow that standard?


There's some documentation to be found on SQL naming conventions. Here's one, for example

Also never use a dot '.' in any SQL server object name as this will break a number of tools, including Microsoft's own SqlBulkCopy class.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜