title: ORACLE sql query for getting top 3 salaries rownum greater than
body: <p>I want to write a query to display employees getting top 3 salaries</p>
  
  <pre><code>  SELECT *
      FROM (SELECT salary, first_name
              FROM employees
          ORDER BY salary desc)
     WHERE rownum &lt;= 3;
  </code></pre>
  
  <p>But I dont understand how this rownum is calculated for the nested query
  will this work or if it has problem ,request you to please make me understand:  </p>
  
  <pre><code>SELECT *
    FROM (SELECT salary, first_name 
            FROM employees
        ORDER BY salary )
   WHERE rownum &gt;= 3;
  </code></pre>
  
  <p>I went through this link <a href="https://stackoverflow.com/questions/855422/oracle-sql-why-does-query-select-from-records-where-rownum-5-and-rownum">Oracle/SQL: Why does query &quot;SELECT * FROM records WHERE rownum &gt;= 5 AND rownum &lt;= 10&quot; - return zero rows</a> ,but it again points to a link, which does not gives the answer</p>