| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Primary Key Theory Question
Thank you for your thoughts. My comments are in line.
Leandro Guimarães Faria Corsetti Dutra wrote:
> Em Sun, 28 Mar 2004 18:56:03 +0000, Ben escreveu:
>
>
>>I have decided to do the >>design work as 'properly' as possible. So, I've been reading through posts >>in this group for most of a day. While I wait for Celko's books to arrive, >>I thought I'd put a question to the gurus here.
Another good resource, now on my list. I love seeing my bookshelf sag under the weight
>
>>I've come to a conceptual impasse regarding primary keys. In doing my pen >>and paper design work and I've come up with two issues: Some of my >>entities can only be uniquely identified by all of their properties and >>some of my entities have good candidate keys, but in real life, that data >>might not be known.
If I understand what you are saying here, even if I can't use SSN as the primary key, I should still create a unique index on it. I get that entirely.
The rule of thumb seems good, but the question then becomes _how_ does one generate a surrogate key that is a) unique and b) usable from an application programmer's point of view. In my wandering I read numerous options that the Sybase/MS Identity column is not good design, and I assume sequences in Oracle would be considered with about the same disdain. I'm no stranger to issues with Identity columns, and I think I understand the theoretical reason why they are not 'correct.' But sequences and Identity columns are great from an application developers point of view because you have easy access to the key of a newly created record. I'm not asking this question out of ignorance, I know I could select the max value of the column + 1, but this method *seems* to bring up whole new worries about concurrency and actually using the DB from a program.
Thanks again for your thoughts.
BK Received on Sun Mar 28 2004 - 15:53:07 CST
![]() |
![]() |