I\'m trying to figure out the \"best practices\" for deciding whether or not to add an auto-incrementing integer as the primary key to a table.
Let\'s say I have a t
You've got the idea right there.
Auto-increment should be used as a unique key when no unique key already exists about the items you are modelling. So for Elements you could use the Atomic Number or Books the ISBN number.
But if people are posting messages on a message board then these need a unique ID, but don't contain one naturally so we assign the next number from a list.
It make sense to use natural keys where possible, just remember to make the field as the primary key and ensure that it is indexed for performance