Third highest salary using rank function in Postgres Sql
<p>Query for third highest salary using rank function </p>

<pre><code>select * 
from (
    select emp_sal,row_number()over() as RANK 
    from (
       select emp_sal 
       from emp_demo 
       order by emp_sal desc
    )
)K 
where K.RANK=3
</code></pre>

<p>error coming as </p>

<pre><code>*ERROR:  subquery in FROM must have an alias
LINE 1: ...m (select emp_sal,row_number()over() as RANK from (select em...
                                                             ^
HINT:  For example, FROM (SELECT ...) [AS] foo.
********** Error **********
ERROR: subquery in FROM must have an alias
SQL state: 42601
Hint: For example, FROM (SELECT ...) [AS] foo.
Character: 63*
</code></pre>

<p>I am not able to display third highest salary in RazorSQL (also in Postgresql)</p>