title: sql what is the order of variable evaluation
body: <pre><code>SET @rowse := -1;
    SELECT
        @rowse := @rowse + 1 AS rowses ,
        STATION.LAT_N AS LAT_N
     FROM
        STATION
     ORDER BY STATION.LAT_N
  </code></pre>
  <p>What is the order of evaluation of the variable and order by.</p>
  <p>1.Will the order by performed first and then the evaluation of @rowse := @rowse + 1 take place? Thus leading to sorted LAT_N and all the rowses are consecutive.</p>
  <ol start="2">
  <li>or the  @rowse := @rowse + 1  is first evaluated and assigned to every row and then order by on station.lat_n will take place leading to sorted LAT_N but possibility of non consecutive rowses.</li>
  </ol>
  <p>In MySQL 1st takes place but I am not able to understand when ORDER BY is evaluated after SELECT according to MANUAL then how come case 1 takes place.
  Any help is really appreciated.</p>