i need department wise top 2 employees salary.which logic
i will use
Answer Posted / kavitha
SELECT distinct a.department_id, a.salary
FROM (SELECT department_id, salary,
DENSE_RANK () OVER (PARTITION BY department_id ORDER BY salary DESC NULLS LAST) max_sal
FROM employees
WHERE department_id IS NOT NULL) a
WHERE max_sal <= 2
| Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
what is blob? : Sql dba
What is sql and its types?
what is denormalization. : Sql dba
What is foreign key sql?
What is the purpose of the partition table?
How much does sql certification cost?
Is left join faster than inner join?
How do I run a query in pl sql developer?
How does a self join work?
What are transaction and its controls?
What is the difference between delete and truncate statement in sql?
How many sectors are in a partition?
What is trigger and stored procedure in sql?
What are %type and %rowtype for?
Explain mutating table error.