By o_j_t
via databasedev.co.uk
Published: Jan 24 2008 / 15:00
Database developers have historically used a somewhat cryptic system for naming database tables and fields. Originally a result of the limitations of database management systems (DBMS), these naming schemes - or the lack thereof - have become adopted by convention and tradition. However, as database applications become more complex, with more tables and larger teams of developers, and as developers come and go, it becomes much more important to implement a robust and disciplined naming scheme for database objects. A well-defined naming scheme becomes more important when you adopt object relational mapping (ORM) technologies or automatic code generation
This article presents one scheme that has worked for me for years in multiple successful commercial applications.
Comments
daniel replied ago:
IMHO it's a bad scheme, but the article is still an interesting read.
LudoA replied ago:
Why do you find it a bad scheme (just curious)?
daniel replied ago:
Two reasons: prefixes and dissimilar primary key fields. Prefixes just annoy me mainly because they rarely communicate something we don't already know (I *know* it's a table, I don't need to type three extra chars each time to remind myself). Also, they make employing ORMs more interesting. Not difficult per se (any decent ORM will handle arbitrary table name conventions with ease), but atypical.
The primary key think is a taste issue really. I like all my primary keys to be the same name (I usually like "id"). That way I know what the key is without ever having to look at the schema, I can just type away and formulate a query without thinking. I'm not really opposed to other field conventions though, as long as they don't include prefixes. :-)
Jeremy Weiskotten replied ago:
I agree... this is pretty painful.
jtheory replied ago:
I had pretty much the same reaction -- he's clearly put some thought into this, but I disagree with almost all of his conclusions. I'm writing a blog post of my own to respond in depth.
jtheory replied ago:
Here's a reply I wrote up.
http://www.dzone.com/links/database_naming_a_response.html
dzonelurker replied ago:
ISO/IEC 11179-5
Voters For This Link (7)
Voters Against This Link (4)