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
What is the difference between a subquery and a join?
what is a database? : Sql dba
Explain alias in sql?
How many sql statements are used?
Can sql function call stored procedure?
Does varchar need length?
Can we use insert statement in function?
what are the types of join and explain each? : Sql dba
How to place comments in pl/sql?
How do you identify a primary key?
What is the function that is used to transfer a pl/sql table log to a database table?
What is indexing in sql and its types?
How do I make my sql query run faster?
what is query cache in mysql? : Sql dba
What is Collation Sensitivity ? What are the various type ?