Geeks With Blogs

The Lanham Factor The (ir)rational thoughts of a (not-so)mad man

and the Artificial Key won.

I don't know what my problem is with artificial keys.  I am a HUGE advocate of natural keys.  My problem is, I tend to use "natural" keys where one really doesn't exist.  For some reason, I am fixated on avoiding duplication.  However, I tend forget what is an appropriate duplication and what isn't.  Take the following example:

Entity-Relationship Diagrams

What do I care if someone duplicates a URL?  I mean, really...does it matter if the same link is listed twice?  It does NOT.  Sheesh!  I am just killing myself.

So, in the end, had I conducted a little database design I would have never incurred the problem.  So the next time you see me blogging about databound controls or database design issues...please remind me to use artificial keys where appropriate.  Thanks!

Posted on Monday, January 21, 2008 7:34 PM SILC - Solution Implementation Life Cycle , Cutting Code | Back to top


Comments on this post: I Fought the Artificial Key...

# re: I Fought the Artificial Key...
Requesting Gravatar...
Fine. Avoid duplication. Just keep in mind that you also avoid duplication by using UNIQUE constraints.
I generally use artificial primary keys, and add UNIQUE constraint on the field(s) that represent the natural key.
So, in your example, if you consider the URL the natural key and want to avoid duplication, just add the constraint and you have the best of both worlds
Left by Carlos Vacca on Apr 02, 2008 11:29 AM

Your comment:
 (will show your gravatar)


Copyright © Brian Lanham | Powered by: GeeksWithBlogs.net