title: How do I assign auto-incrementing IDs that restart for each new person in MySQL?
body: <p>If I have a table like this:</p>
  
  <pre><code>PersonId   
  Joe         
  Joe
  Joe
  Joe
  Frank
  Frank
  Frank
  Frank
  </code></pre>
  
  <p>And want to get it to look like this:</p>
  
  <pre><code>PersonId   id
  Joe        1     
  Joe        2
  Joe        3
  Joe        4
  Frank      1
  Frank      2
  Frank      3
  Frank      4
  </code></pre>
  
  <p>How do I do that? Something like <code>alter table add id int auto_increment, add primary key (id)</code> but with more arguments to make the auto-increment reset after each new name and with no primary key because there will be duplicate values.</p>