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 sql used for?
Why should I use postgresql?
How can we find duplicate records in a table?
How do you modify a column in sql?
What is consistency?
Why do we use procedures?
Does postgresql run on the cloud?
What is output spooling in sql*plus?
What are different clauses used in sql?
What are the usages of sql?
What sql database should I use?
What is query syntax?
Is left join faster than join?
What is the difference between union and union all command?
What are character functions in sql?