KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Creating primary keys
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: July 2, 2007

When deciding how to create primary keys for tables in 4D there is a very simple rule that can be followed:

Make the first field of every table you create a long integer ID field. Do this even if you do not think the table will need an ID field, because someday it might, and having a consistent ID field as the first field of every table can be very helpful.

This field ideally should not contain data. Data can, and will change, and if you alter the primary key you will break your relations.