Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Primary Key
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00171828
Message ID:
00172115
Views:
30
>James,
>
>In relational databse design every table MUST have a primary key (don't confuse this with a primary index in VFP). A primary key is defined as, "an attribute or group of attributes that uniquely and umabigmously identifies a specific instance of the entity." It is the interaction of Primary keys and foreign keys that allows tables data to be related to each other and produce information from data.
>
>Primary keys can be found in one of two types, natural and surrogate. A Natural primary key is one in which the attributes that comprise the primary key would be required in teht albe even if they were not being used as the primary key, that is they are a natural attribute of the entity. A surrogate primary key is one that exist for the sole purpose of being the primary key and has no other meaning in the entity.
>
>The benefits of surrogate primary keys are many, among them;
>
>1) since the PK has no meaning the user will not desire to change it value therefore removing a whole bunch of referential integerity issues for the developer.
>
>2) also teh meaningless nature of the surrogate key eliminates any need to reuse old deleted values, thus allowing the genration of a new key for every new record and eliminating the issue related to deleted records and the uniqueness of the Primary index.
>
>3) since a surrogate key is always one field, there is no nedd to carry normalization beyond Boyce-Codd normal form because 4th and 5th only apply to mulitattribute primary keys.
>
>4) by using the surrogate primary key you can relegate the issue of uniqueness of any candidate keys (like Invice number and the such) to business rules and not use the unique index types and theri implicit errors when uniqueness is violated.
>
>This is 4 of a number of reasons to favor surrogate keys. There are many other reasons too.

Jim,

That's a pretty cogent explanation. Actually, it turns out I've been using surrogate primary keys all along -- I just never knew what they were called. The user can never change my keys because they are never exposed. Any you're write, I was confusing primary keys with primary indices.

Thank you for the clarification.

regards,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Previous
Reply
Map
View

Click here to load this message in the networking platform