how to find the second highest salary in a given table????
Answers were Sorted based on User's Feedback
Answer / kedar
select max(salary) from employees where salary < (select
max(salary) from employees);
the max salary is 24000
& second max is 17000
chwck out
| Is This Answer Correct ? | 8 Yes | 0 No |
Answer / shahnaz
To find the 2nd highest salary from emp table:
select max(sal) from emp where sal not in (select max(sal)
from emp )
| Is This Answer Correct ? | 3 Yes | 2 No |
Answer / manikandan. s
This is the nth max
SELECT salary
FROM (SELECT ROWNUM sl, salary
FROM (SELECT salary
FROM employees
GROUP BY salary
ORDER BY salary))
WHERE sl = n
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / mahesh
SELECT *
FROM (SELECT ROWNUM sl, salary
FROM (SELECT DISTINCT salary
FROM employees
ORDER BY salary))
WHERE sl = n
| Is This Answer Correct ? | 0 Yes | 0 No |
SELECT MAX( Sal ), LEVEL
FROM Emp
WHERE LEVEl = &Givelevelno
CONNECT BY PRIOR Sal > Sal
GROUP BY LEVEL;
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the order of defining local variables and sub procedures/functions?
what diffrence between function and procedure?
Difference between inner join vs where ?
What is where clause in oracle?
What are the execution control statements in oracle?
How to turn on or off recycle bin for the instance?
How to create id with auto_increment on oracle?
What will be the syntax to find current date and time in format "yyyy-mm-dd"?
What are privileges and grants?
Define Transaction ?
Explain database link?
How to create a new user account in oracle?