How to Select second Maximum salary in a Table ?

Answer Posted / abhijit

select max(sal) from table_name where
sal<(select max(sal) from table_name);

or

select sal from(select sal,dense_rank() over(order by sal
desc)
as rnk from table_name) where rnk=2;

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the difference between substr and instr function in oracle?

591


What is difference between cartesian join and cross join?

593


Explain the use of consistent option in exp command.

554


How to assign data of the deleted row to variables?

586


What happens in oracle commit?

574






List the various oracle database objects?

605


How do you tell what your machine name is and what is its IP address?

1520


What is difference between sid and service name in oracle?

521


How to define an oracle sub procedure?

605


How to rename an index?

590


Can we write insert statement in function in oracle?

540


What is system tablespace?

636


Can any one explain me when i execute below query.. select months_between('07-JUL-12','10-FEB-12') from dual; Out put:- 4.90322581 How oracle calculate?

937


What do you mean by group by clause?

565


What is the implicit cursor in oracle?

570