I’m starting to develop an application using MySQL and although I’ve developed apps before using databases, I’ve normally gone to the incrementing id method. The other day I was reading a posting somewhere and saw someone being picked apart for this, for not properly “normalising the database”. I’m not a big database person, but I wanted to make sure I’m doing this right.
Any ideas, help / guidance?
There are two main methods for picking a primary key:
There are general advantages and disadvantages for both methods, and you may want to chose a natural key in some situations and a surrogate key in others.
I hope this serves as a brief introduction, so that you may be able to go further into your research on how to choose appropriate primary keys.