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


Please Help Members By Posting Answers For Below Questions

Sql technical questions

779


what is the different between now() and current_date()? : Sql dba

526


Explain polymorphism in pl/sql.

641


What is the best partition size for windows 10?

487


what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba

579






How can I change database name in sql?

533


What is on delete set null?

570


Does sap use sql?

519


What is foreign key in sql with example?

515


what is rdbms? : Sql dba

583


What is the difference between sql and t sql?

539


Explain the components of sql?

593


What is java sql connection?

516


Explain what is dbms?

581


How do you update a value in sql?

549