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
What is the difference between cross join and natural join?
Does sql full backup truncate logs?
What is lookup table in sql?
How can a function retun more than one value in oracle with proper example?
Can delete statement be rollbacked?
How do we accept inputs from user during runtime?
How do sql databases work?
what are dynamic queries in t-sql? : Transact sql
explain the delete statements in sql
What are the types of variables use in pl sql?
What is trigger types of trigger?
Which is better varchar or nvarchar?
Is oracel sql developer written in java?
What is set transaction?
Does mysql support pl sql?