Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Primary key
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00766466
Message ID:
00766758
Vues:
18
John,

when bringing your datamodel into the 3rd normal form it is often so that the primary key of the table is unrelated to the data inside the table. This means that the primary key could be used. This does not mean that you can´t have an alternate key (user defined) that may be unique as well.

When creating such an index in VFP you must remember that this alternate (or candidate key) must also be unique. You can´t therefor create a value, delete it and re-insert it. Accoring to VFP the deleted value is still present in the database and you must pack the database before re-inserting.

I use generated pk in all my tables. Once you use it you get accustomed....
When joing tables I don´t need to worry if key values are the same. I´m looking for primary and foreign keys and they share the same datatype within all databases.

For 100 tables you have 100 pk´s (primary keys) and when the tables are related you must also have fk (foreign keys). I prefer this situation, I don´t like to use concatenated keys for relations. Pk´s and fk´s are easy to maintain.


Regards,

Ron

>Hi,
>I have read couple of articles and thread messages that suggest to use GUID or auto-generated value as primary key.
>Does it complicated while doing maintenance of error checking since we don't really know what that primary key value refer to?
>
>Also, if I have alot of 100 tables, then I should have 100 records in my key table?
>
>Thank you
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform