Re: Column naming convention good or bad?

From: Jan Lenders <J.Lenders_at_Betuwe.net>
Date: Mon, 20 Nov 2000 08:39:20 GMT
Message-ID: <8vanvo$s59$1_at_nnrp1.deja.com>


In article <3a141b0c.96565553_at_news.compuserve.com>,   MSherrill_at_compuserve.com wrote:
> On Tue, 14 Nov 2000 22:26:25 -0500, "Ali Tajdari"
> <tajdaria_at_nettally.com> wrote:
>
> >My company is developing an SQL coding conventions document. We are
> >currently considering using a three letter prefix for column names.
 The
> >prefix would indicate the columns data type. Has anyone applied
 this type
> >of standard before and was it useful? Is this naming convention bad?
>
> Yes, it's bad. Think about what happens when a column changes type
> from integer to long. If you prefixed it with "int", you have to
> change it to "lng".
>
> Now your views don't work, because they're looking for "int". Any
> client software that's based on those views breaks, too.
>
> So you have to either fix the views, or alias the column (as in
> "SELECT lngBadIdea AS intBadIdea...").
>
> If you had prefixed the column name with "num" instead of "int", you
> wouldn't have to fix the views. But you couldn't tell what type it
> was, either.
>
> On top of all that, it reveals storage-level details--one of the
> things relational systems are supposed to hide from us.
>
> --
> Mike Sherrill
> Information Management Systems
>
The data type isn't very interesting, the semantic data type (attribute data class) *is*. So IMHO you'd better use "amt" for an amount, "oid" for identifier, "prc" for percentage, "grd" for grade etc. The way it is stored is not important.
Also IMHO this kind of information should be at the end of the column name (left to right from most relevant to less relevant), so the column indicating how good an idea is, should be called "Idea_Value_grd" because it's all about idea's and not about the way things are stored.

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Mon Nov 20 2000 - 09:39:20 CET

Original text of this message