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
How do I remove sql plus from windows 10?
What is trigger explain with example?
What is cursor in pl sql with examples?
Why is normalization important?
How can I change database name in sql?
What are all the different normalization?
How do I view a sql database?
Is coalesce faster than isnull?
What programs use sql?
what are the advantages of sql ? : Sql dba
What is left join in sql?
what are the different index configurations a table can have? : Sql dba
Explain how to use transactions efficiently : transact sql
What is right join sql?
What is mutating error in pl sql?