title: Row_number function using directly
body: <p>Is there any direct way of using <code>row_number()</code> function? I want to find 2 nd highest salary</p>
  
  <pre><code>SELECT DISTINCT id
      ,salary
      ,depid
      ,ROW_NUMBER() OVER (
          PARTITION BY depid ORDER BY salary DESC
          ) AS rownum
  FROM emp
  WHERE rownum = 2;
  </code></pre>
  
  <p>It gives an error, However the below code works fine.</p>
  
  <pre><code>SELECT *
  FROM (
      SELECT DISTINCT id
          ,salary
          ,depid
          ,ROW_NUMBER() OVER (
              PARTITION BY depid ORDER BY salary DESC
              ) AS rownum
      FROM emp
      ) AS t
  WHERE t.rownum = 2;
  </code></pre>
  
  <p>Is any way of directly using the <code>row_number()</code> function as in the first option which is giving the error?</p>