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...

Query for second maximum salary in each in each department

Answer Posted / swas

SELECT *
FROM
    (
     SELECT e1.*,
     DENSE_RANK() OVER(PARTITION BY Deptno
                ORDER BY Sal DESC
                )TopRank
     FROM Emp e1
     )
WHERE TopRank = 2 
/

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use joins in sql?

932


The in operator may be used if you know the exact value you want to return for at least one of the columns.

1069


what is the difference between a web-garden and a web-farm? : Sql dba

1043


How is data stored on a disk?

990


What is materialized view in sql?

893


How to read/write files from pl/sql?

1011


how can we transpose a table using sql (changing rows to column or vice-versa) ? : Sql dba

925


What is scalar function in sql?

1005


how many ways to get the current time? : Sql dba

973


State few characteristics of pl/sql?

948


Why is a primary key important?

997


What port does sql server use?

1022


Can we call procedure in select statement?

1000


Which table is left in join?

934


What if we write return in procedure?

1375