Re: Naming conventions for special database objects
- From: --CELKO-- <jcelko212@xxxxxxxxxxxxx>
- Date: Mon, 28 Apr 2008 07:28:09 -0700 (PDT)
literature for some special objects. <<I am currently doing a review of my personal database naming conventions and found that there are not much (good) examples in the
Have you looked at the ISO-11179 Standards? I happen to have a book
on this topic, SQL PROGRAMMING STYLE, based on the Standards and few
decades of research in code readability.
up. <<Certainly there are bigger issues in a database project that that, but I would like to try cleaning that
Actually, formatting and style can reduce the cost of maintaining code
(where 80%+ of the total lifetime cost is) by 8-12%.
at least. I do NOT wish to use any prefixes or suffixes such as PK,I am using SQL Server 2005 what requires that constraint names are unique in the whole database, index names to be unique on table level
FK, CK, UQ, DF, Trig and so on. <<
Standard SQL requires that constraint names are unique in the schema.
And you got the affix thing right --name something for what it is and
not for how it is used in one place.
1) Triggers .. <verb><object>_<table name>. <<
Very good and ISO conformant.
2) Check constraints: I use <explanation>_<table name> (e. g. PreventSingleNodes_Relations or ValidateRelationType_Relations) <<
For table level constraints okay; but at the column level you might
want the data element involved
3) Default constraints, Unique constraints .. Better ideas here?
That is because defaults and uniques are really part of the domain of
the attribute rather than a constraint on it
I tend not to put a constraint on them at all. Their nature does not5) Primary key constraints, Foreign key constraints ..<<
change much so I don't need to reference them. If there is an error,
then the message includes that they are PK or FK, so the constraint
name adds no information.
7) Indexes: As SQL Server does not require unique index names in the whole database but just in the table, <<
Standard SQL has no physical access methods, since that is considered
implementation and not language definition. I am not sure if other
products have global or local index (hash, bit vector, etc.) names. I
agree that having the table and column names will add information to
the error messages.
.
- Follow-Ups:
- Re: Naming conventions for special database objects
- From: Carl Kayser
- Re: Naming conventions for special database objects
- References:
- Naming conventions for special database objects
- From: Philipp Post
- Naming conventions for special database objects
- Prev by Date: Re: Historical Reporting with Volatile data
- Next by Date: Re: Naming conventions for special database objects
- Previous by thread: Naming conventions for special database objects
- Next by thread: Re: Naming conventions for special database objects
- Index(es):
Relevant Pages
|