5

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?

Nulldevice
  • 3,926
  • 3
  • 31
  • 37
  • is this a dupe of http://stackoverflow.com/questions/7662/database-table-and-column-naming-conventions ? – Zac Thompson Apr 28 '10 at 20:56
  • It is not. My question is more generic - I am interested in a naming guide for all SQL database metadata objects - tables, indexes, foreign keys, views, materialized views, triggers, functions, etc. – Nulldevice Apr 29 '10 at 17:24

3 Answers3

2

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.

Community
  • 1
  • 1
Zac Thompson
  • 12,401
  • 45
  • 57
1

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.
  • 101,727
  • 34
  • 178
  • 212
  • 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 Apr 09 '10 at 19:01
0

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
  • 17,121
  • 25
  • 77
  • 111