What Makes a Good Primary Key?
Look for these features when you select a primary key.
September 18, 2001
Good primary keys are essential to good database design. They let you query and modify each table row individually without changing other rows in the same table. When you evaluate candidates for a table's primary key, follow these rules:
The primary key should consist of one column whenever possible.
The name should mean the same 5 years from now as it does today.
The data value should be non-null and remain constant over time.
The data type should be either an integer or a short, fixed-width character.
If you're using a character data type, the primary key should exclude differential capitalization, spaces, and special characters, which might be difficult to remember.
For additional information about choosing a good primary key, see SQL by Design, "How to Choose a Primary Key," April 1999.
About the Author
You May Also Like