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

how can we destroy the cookie? : Sql dba

1007


What is difference between inner join and self join?

1079


Could you please provide oca (oracle 10g) dumps for my certification ?

5156


How is use pl and sql?

1058


Is a table valued function object?

1007


what are the different type of sql's statements ? : Sql dba

924


What is data control language (dcl)?

1131


Does sql support programming?

1064


How do you select unique values in sql?

997


what is the use of set statement in tsql? : Transact sql

1007


What is trigger in pl sql?

990


What are the sql versions?

939


What is sqlerrm?

929


how to create a new view in mysql? : Sql dba

927


How many primary keys can a table have?

1005