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
Which is better join or inner query?
How do I run a sql script?
what are aggregate and scalar functions? : Sql dba
Can you load data into multiple tables at once? : aql loader
Can we create foreign key without primary key?
What is before and after trigger?
What is the difference between between and in condition operators?
Is postgresql a nosql database?
Which is better stored procedure or query?
How do I find duplicates in sql?
How do I run a script in sql developer?
What is the purpose of a sql?
Why is partition used in sql?
How do you declare a constant?
what is the difference between ereg_replace() and eregi_replace()? : Sql dba