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

Which is faster view or stored procedure?

610


How run sql*plus commands that are stored in a local file?

605


What is partition by in sql?

667


Is it possible to read/write files to-and-from PL/SQL?

740


What's the procedure?

569






What are triggers and its uses?

689


Explain character-manipulation functions?

732


What is sql and its types?

717


How do you delete a table?

651


Explain mutating table error.

741


State some properties of relational databases?

672


What are the different dcl commands in sql?

670


What does the acronym acid stand for in database management?

672


How can you select unique records from a table?

616


Does pl/sql support create command?

661