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

i need department wise top 2 employees salary.which logic
i will use

Answer Posted / ashok kumar y

SELECT a.deptno, a.sal
FROM (SELECT deptno, sal,
DENSE_RANK () OVER (PARTITION BY deptno ORDER BY sal DESC NULLS LAST) max_sal
FROM emp
WHERE deptno IS NOT NULL) a
WHERE max_sal <= 2 group by deptno,sal ;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between cross join and natural join?

999


Does sql full backup truncate logs?

1007


What is lookup table in sql?

1019


How can a function retun more than one value in oracle with proper example?

1061


Can delete statement be rollbacked?

968


How do we accept inputs from user during runtime?

1043


How do sql databases work?

982


what are dynamic queries in t-sql? : Transact sql

1004


explain the delete statements in sql

1028


What are the types of variables use in pl sql?

1025


What is trigger types of trigger?

1050


Which is better varchar or nvarchar?

977


Is oracel sql developer written in java?

1089


What is set transaction?

1018


Does mysql support pl sql?

1143