how to check the 3rd max salary from an employee table?
Answer Posted / a.brahmam
select * from(select rownum r,sal from(select * from table name order by sal desc))
where r=3;
(or)
select * from(select rownum,sal from table name order by sal desc)
where rownum<=3
minus
select * from(select rownum,sal from table name order by sal desc)
where rownum<=2
(or)
select * from(select sal,dense_rank()over(order by sal desc)r from table name)
where r=3
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the current version of postgresql?
What is the best sql course?
Can we rollback truncate?
If a cursor is open, how can we find in a pl/sql block?
Does group by remove duplicates?
What is your daily office routine?
how to use regular expression in pattern match conditions? : Sql dba
Can we use distinct and group by together?
what is bcp? When does it used? : Sql dba
what are all the common sql function? : Sql dba
what is sql server agent? : Sql dba
Do we need to rebuild index after truncate?
what is dbms? : Sql dba
what is schema? : Sql dba
what are the advantages of sql ? : Sql dba