Re: Dates in Primary Keys
Date: 07 Jan 2000 06:19:22 GMT
Message-ID: <20000107011922.06663.00000333_at_ng-fc1.aol.com>
>Simply put, I hate dates in Primary Keys. However, I have a manager that
>loves to use dates in compound key situations giving the record it's
>uniqueness. What kind of arguments could I raise on why this is NOT a good
>design.
>
>Any thoughts would be appreciated.
>
>gl
If you have a detail table, or another table with a FK relationship back to the date-keyed table, you cannot change the date in the primary without a lot of effort (create a duplicate with the new key, update the children's FK to point to the new row, delete the old row).
Also, I think it is better to have a single sequence-generated PK/FK...why duplicate all the columns of a multi-column key in detail rows (and the lenghty join conditions you need to replicate every time you want to get the associated rows)
I encountered this situation in a calendar application - this design meant you could not easily change the date of an appointment (master was appointment, detail was topics to be discussed). Fun-fun-fun.
Dan Hekimian-Williams
My preference is to have a sequence-generated PK that is used, and have UKs
based on business/logical rules.
Received on Fri Jan 07 2000 - 07:19:22 CET