Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Primary keys useless?
Message
 
To
02/09/1997 21:07:30
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00047863
Message ID:
00048205
Views:
22
Frederico,

Ok, the definition of a candidate key is any attribute or set of attributes that meet the requirements of being the primary key. The definition of a primary key is;

1) Absolutely unique value within the table
2) all that is needed to unambigously indentify a specific instance within the table
3) can never be NULL (nor can any part of it be NULL)

Now lets see about your natural key, it gets a vlaue that is unique. Ok so far. It is never allowed to be NULL, ok again. When a record is marked inactive (deleted) it retains its key, still ok. You add a new record and try to reuse that key ( bells whistles sirens fireworks noise) hey we just violated the candidency of this key, it is no longer a candidate key, it violates the definition of a candidate key because there may two records in the table with the same value.

The real problem is that you are confusing business rules with relational rules. The business needs this key to be unique for active records. Index types of candidate and primary do not enforce business rulkes, they enforce relational rules. The Valid rule for that field is used to enforce business rules, not the index type.
Previous
Reply
Map
View

Click here to load this message in the networking platform