views:

75

answers:

3

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?

+1  A: 

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?

KM
Mmm. It is not a problem to create a guide, but I want to reuse some existing. This is not because I lazy, but because I want to make some economy. In my experience, a reuse of existing product is far less expensive than creation from start.
Nulldevice
A: 

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.

edosoft
I see you are .NET guy. Microsoft a big company with many standards. May be you can remember some public guide from Microsoft on this topic?
Nulldevice
+1  A: 

There are good links and discussion in this question:

http://stackoverflow.com/questions/7662/database-table-and-column-naming-conventions

You can probably take your pick of the styles there.

Zac Thompson