21 August 2008

Singular Table Name

Almost as bad as prefixing tables with a table-indicator is using plural names. Even Oracle tools default to this... It is just wrong.

A relation constitutes a header and a body. The header (or relational schema) is a set of attribute (column) and domain (value) pairs. The body is the set of tuples (rows). A tuple is a valued occurrence of the header.

Consequently, if you make your table names plural, make your column names plural for consistency.

Less mathematical justifications for using singular tables names include:

Consistency - Because sometimes you need 'es' to pluralize a word.
Consistency - Shouldn't 'ProductOrders' be 'ProductsOrders?'

Just like your mother taught you, just because everyone else is doing it, doesn't make it right.


Tags: ,

2 comments:

Anonymous said...

You know, most people I have talked to list ONE reason they use plural names: because they have an ORDER table.

You can't use ORDER, they don't want to use ORDER_TABLE, and so they shift their entire design to plural names because of...ORDERS.

Benjamin said...

A decent argument. Do you compromise the whole for a part? Depends on how integral the part is, right?

Even though it is a bit awkward, if it absolutely must be named 'Order,' do you use the reserved word? Which is the lesser of two evils?

Personally, I find that consistency trumps observing reserved words. But the people that I have worked with know that I obsess over not using reserved words. When in doubt, thesaurus!