SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Database and its Objects Naming Standards


Database and its Objects Naming Standards

Author
Message
Lempster
Lempster
SSCertifiable
SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)

Group: General Forum Members
Points: 5013 Visits: 1657
Wot no Celko? ;-)
andrew gothard
andrew gothard
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2712 Visits: 5965
I don't get pluralisation, certainly US based folk seem to be all for it, Brits less so. Perhaps it's due to a difference in the teaching of sets?
Here, I was taught
Set:Red a set with the attribult of being red
Set:Car a set with the attribute of being a car
the intersection in a venn diagram would be a set which are both Red and a Car.

Pluralisation also, IMO, leads to inconsistency in naming.
Take the table holding sales orders;
Name SalesOrder - and you call the table holding the associated lines SalesOrderLine - makes sense to me;

SalesOrders - so then you have SalesOrdersLines (or more correctly [SalesOrders'Lines])? That just looks wrong to me.

Or is it SalesOrderLines - which means you're naming the SalesOrder(s) element inconsistently

I'm a DBA.
I'm not paid to solve problems. I'm paid to prevent them.
Jack Corbett
  Jack Corbett
SSC-Forever
SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)

Group: General Forum Members
Points: 43339 Visits: 14925
Andrew,

Here's my explanation for pluralization. Because the table doesn't contain a car it contains cars. The row is a car the table is a set of cars. In your Sales Order example my naming would be:

SalesOrders - the table contains multiple sales orders not a single sales order
SalesOrderLines - Non-plural Sales Order because the each of the lines belongs to a single sales order, but the table contains many sales order lines

Naming conventions are always going to be debated, but to paraphrase Grant the important thing isn't what the standard itself is, but that you have and enforce one. In reality I'd name the tables sales_orders and sales_order_lines.



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Mike John
Mike John
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3332 Visits: 5983
Totally agree with Jack.

Mike John



Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (209K reputation)SSC Guru (209K reputation)SSC Guru (209K reputation)SSC Guru (209K reputation)SSC Guru (209K reputation)SSC Guru (209K reputation)SSC Guru (209K reputation)SSC Guru (209K reputation)

Group: General Forum Members
Points: 209335 Visits: 41973
Mike John (4/3/2014)
Totally agree with Jack.

Mike John


I don't. I don't believe I've ever seen a Companies table. :-D It's always been just Company where ever I worked.

I tend to name tables after what a single row contains because plurals are a PITA for me. There are "s" plurals, "ies" plurals, "es" plurals, plurals that are the same spelling as the non-plural word, and plurals that are a totally different spelling than the original word.

At the column level, plurals are also a pain. For example, SalesOrdersID just doesn't sound right and I also maintain the standard that, if used, the IDENTITY column in a table must follow the standard naming convention of tablenameID.

I also agree that naming conventions are hotly debated so please understand that my comments above are just an opinion.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Grant Fritchey
Grant Fritchey
SSC Guru
SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)

Group: General Forum Members
Points: 96007 Visits: 33013
Cars is an extra letter and I'm a completely lazy SOB. I'd rather just have Car, as long as it's clear, right. I mean, not Cr or something else stupid.

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
Cody Konior
Cody Konior
SSC Eights!
SSC Eights! (999 reputation)SSC Eights! (999 reputation)SSC Eights! (999 reputation)SSC Eights! (999 reputation)SSC Eights! (999 reputation)SSC Eights! (999 reputation)SSC Eights! (999 reputation)SSC Eights! (999 reputation)

Group: General Forum Members
Points: 999 Visits: 1110
Grant Fritchey (4/13/2014)
I mean, not Cr or something else stupid.


And thus the challenge has been issued for the most stupid name we can come up with. tblFWB is my guess, as it's a FourWheeledBuggy of course!
Sean Lange
Sean Lange
SSC Guru
SSC Guru (60K reputation)SSC Guru (60K reputation)SSC Guru (60K reputation)SSC Guru (60K reputation)SSC Guru (60K reputation)SSC Guru (60K reputation)SSC Guru (60K reputation)SSC Guru (60K reputation)

Group: General Forum Members
Points: 60833 Visits: 17954
Jeff Moden (4/12/2014)

I don't believe I've ever seen a Companies table. :-D It's always been just Company where ever I worked.


I have and it has left a permanent scar on my brain. I am a naturally good speller and I was a consultant at a place for almost 3 years that had a "Companys" table. To this day I have to stop and think about how to spell it. This is a real world example of what you describe about the complexities of plurals in English. The table was designed by a non-native English speaker. w00t

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Cody Konior
Cody Konior
SSC Eights!
SSC Eights! (999 reputation)SSC Eights! (999 reputation)SSC Eights! (999 reputation)SSC Eights! (999 reputation)SSC Eights! (999 reputation)SSC Eights! (999 reputation)SSC Eights! (999 reputation)SSC Eights! (999 reputation)

Group: General Forum Members
Points: 999 Visits: 1110
Sean Lange (4/14/2014)
I am a naturally good speller and I was a consultant at a place for almost 3 years that had a "Companys" table.


Yeah I regularly see columns named [SomethingDescrption] in real life and posted here in queries too, where someone didn't spell it right the first time and then it hangs around like that forever. I also saw a column named InvoiceDetails.[InvoiceDetailslId]. See that l? Me neither, for a long time.

Worst of all, were dozens of stored procedures that used dbmail and the word "udpate". They must have been copied pasted or done by a dyslexic but my email inbox was filled with "udpate successful" and "udpate failed" emails for a year before I was confident enough to go through and fix them all.
humbleDBA
humbleDBA
SSC Eights!
SSC Eights! (830 reputation)SSC Eights! (830 reputation)SSC Eights! (830 reputation)SSC Eights! (830 reputation)SSC Eights! (830 reputation)SSC Eights! (830 reputation)SSC Eights! (830 reputation)SSC Eights! (830 reputation)

Group: General Forum Members
Points: 830 Visits: 1508
My opinion...

I agree with Mike John, patrickmcginnis59 10839, andrew gothard, Jeff Moden.

Just my opinion :-D
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search