Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Primary Key
Message
De
02/01/1999 11:37:44
 
 
À
31/12/1998 13:49:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00171828
Message ID:
00172157
Vues:
31
>
>Frankly I have never figured out the purpose of surrogate primary keys. If you need a unique data order, a primary key is the way to go. If you don't need it, then stick with regular indices -- which are a lot easier to work with.
>
>I suspect I don't fully understand their (surrogate keys) utility. I'll have to get one of the wunderkinder to explain it to me sometime.
>
>Best wishes for a happy and successful new year,
>
>regards,

Not that I am a Wunderkind, at 54 I am not a child anymore. But surrogate primary keys ARE the way to go.
The purpose of a primary key is a UNIQUE entity to relate tables to each other.
All you need is a unique integer to accomplish that. And never reuse primary keys. If you have a customer generated Part Number for example make it a candidate key which enforces uniqueness, too. Still add a primary key which is system generated. If the customer changes tha part number for any reason your links are still good. Otherwise you have to make sure you change the links in ALL tables where you have that part number.
I have been using system generated keys for years starting in FP 1.0.
Happy New Year
Peter
Peter Cortiel
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform