473,385 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Re: Database naming conventions?

> I always prefix the column name with a prefix that identifies the
table where it resides. <<

No. You name a data element for WHAT it is, not for WHERE it is. Do
you change your name when you move from room to room? Start with any
good book on data modeling and the ISO-11179 Standards.

You make a name as precise as possible -- not vague like "name", "id",
"date" etc. The ISO format is "<attribute>_<property>" --
"customer_name", "product_id", "birth_date", etc.

Get a copy of SQL PROGRAMMING STYLE and use it for your company's
guidebook. I based it on the ISO-11179 data element naming rules and
the research I did for a few years at AIRMICS (Army Institute for
Research in Management Information & Computer Sciences).

If you use my book:
1) I can make my house payment
2) You can save yourself a lot of work
3) If anyone does not like it, you can blame me! Everybody wins!
Jun 27 '08 #1
9 4887
and the ISO-11179 Standards. <

For those who would like to have a look at it - ISO has several
standards available at no charge here (including 11179)

http://standards.iso.org/ittf/Public...ableStandards/

brgds

Philipp Post
Jun 27 '08 #2
On 23 jun, 12:00, --CELKO-- <jcelko...@earthlink.netwrote:
You make a name as precise as possible -- not vague like "name", "id",
"date" etc. The ISO format is "<attribute>_<property>" *--
"customer_name", "product_id", "birth_date", etc.
I answered it some hours ago and it dindīt already apperar in
Google,So Iīll ask again(In the case it got lost)
Why Costumer_name and not Costumer_BirthDate?
Lets suppose I have a veterinary hospital and whant to know the name
and date of birth of every pet along with the name and date of birth
of their
owners.
By following your example I would end up with two columns witrh the
same name birth_date.

Thanks,
Marcello
Jun 27 '08 #3
>Why customer_name and not costumer_birthdate? <<

That is fine, but you will need to add "_birthdate" as special case of
property. What you would probably have is a role prefix --
"customer_birth_date" and "pet_birth_date", in the tables.

Again, the basic rule is that a data element name tells us WHAT it
is. It does NOT tell us about
1) its locations in the schema
2) how it is used in a particular table (i.e. no PK- or FK- or VW-
affixes in the names
3) how its data is physically stored (i.e. no "i-", "str-" etc.
affixes. for integers, strings, etc).
4) Do not tell us what the data element is not.
Jun 27 '08 #4
"Marcello" <md*@ibest.com.brwrote in message
news:ea**********************************@26g2000h sk.googlegroups.com...
On 23 jun, 12:00, --CELKO-- <jcelko...@earthlink.netwrote:
You make a name as precise as possible -- not vague like "name", "id",
"date" etc. The ISO format is "<attribute>_<property>" --
"customer_name", "product_id", "birth_date", etc.
I answered it some hours ago and it dindīt already apperar in
Google,So Iīll ask again(In the case it got lost)
Why Costumer_name and not Costumer_BirthDate?
Lets suppose I have a veterinary hospital and whant to know the name
and date of birth of every pet along with the name and date of birth
of their
owners.
By following your example I would end up with two columns witrh the
same name birth_date.

Thanks,
Marcello

**************************************************

I wouldn't myself get too twisted up about this. When you're devising column
names you're frequently answering the question "what property of what
entity?" So "name of the customer" and "id of the product" naturally
translate into "customer_name" and "product_id". In your example it's
actually "birth date of the pet", not just "date of birth", because the
latter still begs a question. So something like "pet_birthdate" might be
better if following these conventions.

The distinction comes about because "name" and "id" actually mean
something - they are not just data types. Whereas "date" is a data type.
Further qualification leading to something like "date of birth" or "start
date" introduces real meaning.

AHS
Jun 27 '08 #5
On 23 jun, 17:19, --CELKO-- <jcelko...@earthlink.netwrote:
Why customer_name and not costumer_birthdate? <<

That is fine, but you will need to add "_birthdate" as special case of
property. *What you would probably have is a role prefix --
"customer_birth_date" and "pet_birth_date", in the tables.
But I can think of many other "special cases" like date of
issue,gender and many more.
And If i fail to define a "special case" during the design of the
database,what should I do later,come back and change the field names?

Many advocate,that you should define just birth_date in both tables
and give aliases to the column names for every sql statement.
As i understand you said we should look for "special cases".
Others like to prefix column with table that they belong.
I just didnīt find a perfect schema,I donīt like the idea of using
something just because it is an ISO Standard.

Thanks,
Marcello
Jun 27 '08 #6
Iīll try to redesign a database Iīm desiging right now,following the
iso standards.
In fact it seems to have more pros than cons.
In the vast majority is just replacing te table prefix by the table
name(Although in teory it is not that),but it seems to be more
understandable,since prefixing every table is an annoying job.
It will produce much bigger sql statetements but easier to read in the
overall.

customer_birth_date instead of Cust_BirthDate
pet_birth_date instead of Pet_BirthDate

Thanks,
Marcello

Jun 27 '08 #7
>Many advocate,that you should define just birth_date in both tables and give aliases to the column names for every SQL statement. <<

Data element names are not just for SQL; they are in a Data Dictionary
and everyone should use them.
>I donīt like the idea of using something just because it is an ISO Standard. <<
Using something because it is an ISO Standard is a VERY good reason.

That is the way that Americans felt about the Metric system :) That
is why we no longer dominate the automobile industry, etc.
Jun 27 '08 #8
Marcello,
But I can think of many other "special cases" like date of issue,gender and many more. And If i fail to define a "special case" during the design of the database,what should I do later,come back and change the field names? <
Unfortunately this can happen. However if you took enough time in the
design phase, you could minimize the possibility that it does happen.
It is a bit like chess - asking yourself "Could it happen that I have
to add functionality lateron what will lead to duplicate column
names?". If you have the possibility to change the column names, yes I
would do so, but this usually is a time-consuming task as you have
views, procedures and front-end code what refers to the old column
name.

Rushing in the design phase creates workload lateron in x-degree of
the time you saved by quickly passing through design.

brgds

Philipp Post
Jun 27 '08 #9
Rushing in the design phase creates workload lateron in x-degree of
the time you saved by quickly passing through design.
Quite agree.

After designing relational databases for 33 years:-

I don't like the "_" method - eg "birth_date" as it adds an extra character
which adds little to the meaning.

My preference is for "BirthDate" - mainly because its tends to cause less
problems with reserved words in processing languages, (eg I would use
$BirthDate in perl processing) and its easy to spot if you use all
lowercase (typically sqlserver or sybase) or uppercase (typically Oracle)
for the sql.

Sometimes you have to break the rules - denormalisation is a common culprit.

If you have the same named column in two tables it MUST mean the same
thing - so if you use BirthDate in the Customer table, then in the Animal
table (to use your vet example) you must use something different for the
Animal birth date. However if the Customers BirthDate is part of the
Customer key (Maybe you differentiate Smiths by their date of birth), then
you might well have BirthDate in the Animal table to provide a join with
the Customer table. If this is the case the 'CustBirthDate' is a sensible
name to differentiate from 'AnimalBirthDate'.

As an aside I like to have a list of 'standard' abbreviations I use so in
this case I would have used DoB for BirthDate.
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Cristof Falk | last post by:
I wanted to get a feel. The documentation gives naming conventions for public/protected members. Is this truly widely adopted? And what about using the same conventions for private members and...
1
by: clintonG | last post by:
Does the use of DTD, XML Schema and similar constructs adopt the use of C# naming conventions? If so how do I make the distinction of how to apply C# conventions with XML elements, attributes and...
4
by: Mark Broadbent | last post by:
stupid question time again to most of you experts but this is something that continually bothers me. I am trying to get into the habit of naming variables and controls in an assembly as per...
38
by: news.microsoft.com | last post by:
Greetings, I am posting this message to both the SQL Server and C# news groups because this inquiry is more of a theoretical question that applies to both database and code naming conventions. ...
3
by: clintonG | last post by:
Does the use of DTD, XML Schema and similar constructs adopt the use of C# naming conventions? If so how do I make the distinction of how to apply C# conventions with XML elements, attributes and...
5
by: rastaman | last post by:
Hi all, I know of the existence of Object Naming Conventions for Visual Basic 6. Now I'm reading some books about VB .NET, but the names used for the objects are button1, picturebox1, etc. I...
4
by: Patrick | last post by:
what are the general naming conventions for vb.net controls. esp txtUserName, lblPassword, btnSubmit What are the prefixes for the controls???? I've tried to search hi and low on the net, but...
11
by: MP | last post by:
Hi, Coming from a vb6 background I am accustomed to prefixing variable names to indicate their usage. Now just beginning to try to learn database stuff I've been lurking here and working on my...
9
by: BillCo | last post by:
I'm coming from a MS Access background and so I'm very used to and comfortable with the hungarian (Leszynski et al) naming conventions. However, I'm getting started into my first SQL Server...
1
by: Philipp Post | last post by:
Marcello, Not a big surprise as naming conventions have a lot to do with personal prefernces. There are a lot of threads in comp.databases and the other database groups. Just do a search for...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.