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 stored procedure and view?
What is the difference between delete and truncate commands?
Can we rollback after truncate?
What are the benefits of triggers?
How much does a sql dba make? : SQL DBA
Explain the methods used to protect source code of pl/sql.
What is the difference between a primary key and a unique key?
When sql appeared?
What are stuff and replace function?
What is the difference between alter trigger and drop trigger statements?
Explian rowid, rownum? What are the psoducolumns we have?
How many triggers can be applied on a table?
What is a sql profiler?
how can we optimize or increase the speed of a mysql select query? : Sql dba
What do you mean by field in sql?