Write a query to get 2nd maximum salary in an employee table ?
Answer Posted / mark berlin.
REM solution #1:
select * from(
select distinct nvl(salary,-1) as sal
from employees
where nvl(salary,-1) < (select max(nvl(salary,-1)) from
employees)
order by nvl(salary,-1) desc)
where rownum=1;
REM Solution #2
select * from (
select distinct salary from employees
order by salary
desc
)
where rownum < 3
minus
select * from (
select distinct salary from employees
order by salary
desc
)
where rownum =1;
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What version is sql?
Explain what is dbms?
How do I start pl sql?
Can a foreign key be null?
Can we perform dml on view?
What are user defined functions?
How many unique keys can a table have?
Explain how can you save or place your msg in a table?
How to return an array from java to pl/sql?
What is the limitation on the block size of pl/sql?
Can function return multiple values in sql?
What does (*) mean in sql?
What is a function in oracle pl sql?
Why is normalization important?
How does a self join work?