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
Can I create table without primary key?
How does sql*loader handles newline characters in a record? : aql loader
Explain clause in sql?
which types of join is used in sql widely? : Sql dba
How do I add a database to sql?
What is sql entity?
How to select unique records from a table?
How do I view a table in sql?
Define commit, rollback and savepoint?
What is thread join () in threading?
What are the string functions in sql?
what are the system privileges that are required by a schema owner (user) to create a trigger on a table?
What is sp_helptext?
How does cross join work?
Is pl sql and postgresql same?