title: Nth max salary in Oracle
body: <p>To find out the Nth max sal in oracle i'm using below query</p>
  
  <pre><code>SELECT DISTINCE sal 
  FROM emp a 
  WHERE (
         SELECT COUNT(DISTINCE sal) 
         FROM emp b 
         WHERE a.sal&lt;=b.sal)=&amp;n;
  </code></pre>
  
  <ul>
  <li><p>But According to me by using the above query it will take more time to execute if table size is big.</p></li>
  <li><p>i'm trying to use the below query</p>
  
  <pre><code>SELECT sal 
  FROM (
        SELECT DISTINCE sal 
        FROM emp 
             ORDER BY sal DESC ) 
  WHERE rownum=3;
  </code></pre></li>
  <li><p>but not getting output.. any suggetions please .. Please share any link on how to optimise queries and decrease the time for a query to execute.</p></li>
  </ul>