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
Is it possible to remove child records without removing master table records...the two having pk,fk relationship?
What is full join?
What is nvl?
How can the performance of a trigger be improved?
Which join condition can be specified using on clause?
What are the benefits of pl sql?
Explain mutating table error.
Is sqlite good enough for production?
Why do we need sharding?
Explain raise_application_error.
What is error ora-12154: tns:could not resolve the connect identifier specified?
What is break?
What is a native sql query?
what is union? : Sql dba
What is trigger and how to use it in sql?