Quote:Original post by graveyard filla
In the case of PK's - some tables have fields which "naturally" fit as primary keys... for example, in a "user" table (that stores users login names and passwords), the user_name field would make a good fit for a primary key, since obviously you want to force users to create unique usernames.
Good example, but I'd add one corollary. A primary key should have two features:
1. It uniquely identifies the record. (This is required.)
2. It is static. (This is recommended.)
Your example works best if the user_name field never changes. If the user can change his name, the database will have to perform cascading updates in order to maintain data integrity; so in that case, it would make sense to have a separate auto-incrementing primary key, and a unique index on the user_name field.