title: Row Rank in a MySQL View
body: <p>I need to create a view that automatically adds virtual row number in the result. the graph here is totally random all that I want to achieve is the last column to be created dynamically. </p>
  
  <pre><code>&gt; +--------+------------+-----+
  &gt; | id     | variety    | num |
  &gt; +--------+------------+-----+
  &gt; | 234    | fuji       |   1 |
  &gt; | 4356   | gala       |   2 |
  &gt; | 343245 | limbertwig |   3 |
  &gt; | 224    | bing       |   4 |
  &gt; | 4545   | chelan     |   5 |
  &gt; | 3455   | navel      |   6 |
  &gt; | 4534345| valencia   |   7 |
  &gt; | 3451   | bartlett   |   8 |
  &gt; | 3452   | bradford   |   9 |
  &gt; +--------+------------+-----+
  </code></pre>
  
  <p>Query:</p>
  
  <pre><code>SELECT id, 
         variety, 
         SOMEFUNCTIONTHATWOULDGENERATETHIS() AS num 
    FROM mytable
  </code></pre>