Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««1234»»»

Database and its Objects Naming Standards Expand / Collapse
Author
Message
Posted Thursday, April 3, 2014 2:43 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 3:13 AM
Points: 2,036, Visits: 1,380
Wot no Celko?
Post #1557864
Posted Thursday, April 3, 2014 5:07 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Today @ 9:48 AM
Points: 330, Visits: 3,214
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.
Post #1557908
Posted Thursday, April 3, 2014 6:28 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Thursday, July 24, 2014 9:07 AM
Points: 11,157, Visits: 12,899
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

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
Post #1557941
Posted Thursday, April 3, 2014 6:46 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 1:04 PM
Points: 2,663, Visits: 5,798
Totally agree with Jack.

Mike John



Post #1557946
Posted Saturday, April 12, 2014 11:39 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 8:06 PM
Points: 36,786, Visits: 31,243
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. 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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1561263
Posted Sunday, April 13, 2014 5:41 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Today @ 9:27 AM
Points: 15,556, Visits: 27,928
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 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1561273
Posted Sunday, April 13, 2014 7:35 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 7:15 AM
Points: 213, Visits: 829
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!
Post #1561274
Posted Monday, April 14, 2014 7:08 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 9:42 AM
Points: 13,131, Visits: 11,968
Jeff Moden (4/12/2014)

I don't believe I've ever seen a Companies table. 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.


_______________________________________________________________

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 Moden's 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)
Post #1561460
Posted Monday, April 14, 2014 8:16 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 7:15 AM
Points: 213, Visits: 829
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.
Post #1561492
Posted Thursday, April 24, 2014 8:45 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, July 15, 2014 5:09 AM
Points: 215, Visits: 1,356
My opinion...

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

Just my opinion
Post #1564679
« Prev Topic | Next Topic »

Add to briefcase ««1234»»»

Permissions Expand / Collapse