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 command used to fetch the first 5 characters of a string?
What is oracle sql called?
Is primary key clustered or nonclustered?
What is the use of %rowtype?
What is primary and foreign key?
Where can I learn sql for free?
how many ways we can we find the current date using mysql? : Sql dba
Explain what is a subquery ?
what are the advantages of mysql in comparison to oracle? : Sql dba
What is query execution plan in sql?
what's the difference between a primary key and a unique key? : Sql dba
what is foreign key? : Sql dba
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
What is the difference between having clause and where clause?
what is a stored procedure? : Sql dba