Short answer: yes.
- You need your table to be joinable on something
- If you want your table to be clustered, you need some kind of a primary key.
- If your table design does not need a primary key, rethink your design: most probably, you are missing something. Why keep identical records?
InnoDB storage engine always creates a
PRIMARY KEY if you didn’t specify it explicitly, thus making an extra column you don’t have access to.
Besides the logical consistency issues, most
RDBMS engines will benefit from including these fields in an
Answer Two :
if you don’t have a primary key then you are going to have duplication of records somewhere in your table.
if you don’t have an index, BUT a primary key gets an index by default
I tend to agree that most tables should have a primary key. I can only think of two times where it doesn’t make sense to do it.
- If you have a table that relates keys to other keys. For example, to relate a user_id to an answer_id, that table wouldn’t need a primary key.
- A logging table, whose only real purpose is to create an audit trail.