title: Sequentially number rows by keyed group in SQL?
body: <p>Is there a way in SQL to sequentially add a row number <strong>by key group</strong>?</p>
  
  <p>Assume a table with arbitrary (CODE,NAME) tuples.  Example table:</p>
  
  <pre><code>CODE NAME    
  ---- ----
  A    Apple
  A    Angel
  A    Arizona
  B    Bravo
  C    Charlie
  C    Cat
  D    Dog
  D    Doppler
  D    Data
  D    Down
  </code></pre>
  
  <p>Desired projection using CODE as the grouping attribute:</p>
  
  <pre><code>CODE C_NO NAME    
  ---- ---- ----
  A    0    Apple
  A    1    Angel
  A    2    Arizona
  B    0    Bravo
  C    1    Charlie
  C    0    Cat
  D    0    Dog
  D    1    Data
  D    2    Down
  D    3    Doppler
  </code></pre>
  
  <p>Thanks,</p>