how to find the second highest salary from emp table?

Answer Posted / nalini

Follow the following Query, You get the second highest
salary.
SQL> Select level,Max(sal) from emp
Where level=&level connect by prior sal>sal
group by level;
SQL> Enter the level No=2 (Here enter 2 manually)

Then you will get the 2nd highest salary.
If you want 3rd Highest salary, then enter level no=3.

Is This Answer Correct ?    208 Yes 105 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the command used to fetch the first 5 characters of a string?

700


What is oracle sql called?

497


Is primary key clustered or nonclustered?

552


What is the use of %rowtype?

524


What is primary and foreign key?

585






Where can I learn sql for free?

498


how many ways we can we find the current date using mysql? : Sql dba

604


Explain what is a subquery ?

646


what are the advantages of mysql in comparison to oracle? : Sql dba

520


What is query execution plan in sql?

556


what's the difference between a primary key and a unique key? : Sql dba

498


what is foreign key? : Sql dba

578


what are the different tables present in mysql, which type of table is generated when we are creating a table in the following syntax: create table employee (eno int(2),ename varchar(10)) ? : Sql dba

605


What is the difference between having clause and where clause?

555


what is a stored procedure? : Sql dba

543