title: MySQL primary key that I never select
body: <p>Quite often I encounter situation like this:</p>
  
  <pre><code>table `user_adress`
  +----------+-------------+--------------+---------+
  |adress_id | user_id     | adress_type  |adress   |
  +----------+-------------+--------------+---------+
  |        1 |           1 | home         |adressXXX|
  |        2 |           2 | home         |adressXXX|
  |        3 |           3 | home         |adressXXX|
  |        4 |           1 | work         |adressXXX|
  |        5 |           2 | work         |adressXXX|
  |        6 |           1 | second_home  |adressXXX|
  +----------+-------------+--------------+---------+
  </code></pre>
  
  <p>If I want to use it, I'm using queries like this:</p>
  
  <pre><code>SELECT `adress` FROM `user_adress` WHERE `user_id`=1;
  </code></pre>
  
  <p>Seems quite normal, but the thing is, that I use "useless" <code>adress_id</code> column, that has no other purpouse but to be an primary key with autoincrement just for the sake of having an primary key in MySQL table. I never use or need this number. So I figured out that I should not use primary key in my table at all, remove totally <code>adress_id</code>, and set <code>INDEX</code> (without <code>unique</code>) at <code>user_id</code> column. That seems to be good - or am I wrong?</p>
  
  <p>I have some doubts, because as much as I'm reading, everywhere I see advices, that every table should, or even need to have primary key. But why? Perhaps my database is badly designed if I allowed this to happen, but looking on my extreamly simple example table - I can't imagine how this could be the case in every situation, especially in such simple cases. I deffinetly missunderstanded some simple, basic rules about creating tables and properly indexing them - where is the hole in my toughts?</p>