title: Inserting increment for each unique value in sql
body: <p>I've been tasked with a SQL problem that is outside of the limited scope of sql knowledge that I have. I have the following problem. </p>
  
  <p>I have a table that currently looks like this:</p>
  
  <pre><code> widgets
  ---------
      a
      a
      a
      b
      b
      c
      d
      d
      d
  </code></pre>
  
  <p>I would like to have another table that has each unique value incrementally numbered... Like so:</p>
  
  <pre><code>widgets  | widget_id
  --------- ----------
      a    |    1
      a    |    1
      a    |    1
      b    |    2
      b    |    2
      c    |    3
      d    |    4
      d    |    4
      d    |    4
  </code></pre>
  
  <p>I'm not sure how this would be done with an insert statement?</p>