Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Is it possible to create startup or shutdown trigger for on-schema?

981


How bulk collect improves performance?

948


What is assignment operator in pl sql?

970


why does the selected column have to be in the group by clause or part of an aggregate function? : Sql dba

1045


What is online transaction processing (oltp)?

963


What is the difference between a subquery and a join?

1014


What is tuple in sql?

1008


What is the difference between distinct and unique in sql?

876


What is multiple partition?

921


What is pl/sql table? Why it is used?

991


What is transaction control language (tcl)?

1074


What is trigger explain it?

966


What are basic techniques of indexing?

1325


What is %type in sql?

920


what is the difference between sql and t-sql? : Transact sql

1043