Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Primary Key
Message
From
02/01/1999 11:37:44
 
 
To
31/12/1998 13:49:00
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00171828
Message ID:
00172157
Views:
30
>
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform