Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Surrogate Key
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00230735
Message ID:
00230743
Views:
23
Aiko,

The use of a surrogate key has many advantages. One fo the biggest is that there is no need to deal with changes to the value of the key. With a "natural" key, the users may want to change its value and that requires that all foreign keys that refer to the PK must be changed as well. The user will never desire to change what they can't see, so with surrogates there is no need to cascade changes.

Most folks use a siple sequential number for the key. Since they are meaningless, there is no reason to be concerned with missing numbers. I use Integer fields for PK's since they provide for over 2,000,000,000 positive values in 4 bytes. I keep a key table with one record for each table in the system and just increment the value in the table for each append that occurs.
Previous
Reply
Map
View

Click here to load this message in the networking platform