JayIchiyen

The Best Primary Key values

Discussion created by JayIchiyen on Nov 14, 2012
Latest reply on Nov 15, 2012 by anthony@littleman.com.au

I have been wrestling with the best Primary Key values for my database solutions.

A developer once told me to create a calculated key from two fields: 1) a text field and 2) a number field. The text field is a two to four letter abbreviation of the table name ex. INV for the Invoice table. Secondly, a serial number field using the Auto-Enter serial number option. The primary key is a concatenation of these two fields with the number field having the appropriate number of leading zeros. Seems like a lot of work. I’m sure they explained the benefits of this to me at one point but I can’t recall why. Maybe for sorting?

Why wouldn’t I just use one primary key field with an Auto-Enter Serial option that already has the table name in it? Ex INV0001 increment by 1.

Plus, like in Access, why wouldn’t I just use a serial number as I hear that number fields are faster than text fields? I guess having some text would be helpful to identify the ID field data if it were exported and to give it some meaning.

What do you use for primary key values?

Outcomes