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 difference between a subquery and a join?

529


what is a database? : Sql dba

610


Explain alias in sql?

584


How many sql statements are used?

570


Can sql function call stored procedure?

558






Does varchar need length?

520


Can we use insert statement in function?

516


what are the types of join and explain each? : Sql dba

534


How to place comments in pl/sql?

606


How do you identify a primary key?

633


What is the function that is used to transfer a pl/sql table log to a database table?

557


What is indexing in sql and its types?

547


How do I make my sql query run faster?

470


what is query cache in mysql? : Sql dba

577


What is Collation Sensitivity ? What are the various type ?

501