Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Primary keys useless?
Message
 
À
02/09/1997 21:07:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00047863
Message ID:
00048205
Vues:
27
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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform