how will I find the first 5 highest salaried employees in
each dept in oracle.
Answer Posted / murali mohan
Try This,
select empno,deptno,sal,dense_rank from (SELECT empno,
deptno,sal,
DENSE_RANK() OVER (PARTITION BY
deptno ORDER BY sal DESC NULLS
LAST) DENSE_RANK
FROM emp) tmp
where dense_rank<=5;
Regards,
Murali
| Is This Answer Correct ? | 21 Yes | 3 No |
Post New Answer View All Answers
How to insert a record into a table?
What is rich query?
What is PL/SQL ?
1) Does oracle have any table which contain all the exceptions and it's code internally?
How to execute a stored program unit?
Explain the use of ignore option in imp command.
What is a dynamic performance view in oracle?
Give the constructs of a package, function or a procedure.
What are the logical operations?
Explain the use of owner option in exp command.
What is Virtual Private Database in Oracle?
How to list all tables in your schema?
Why do we need integrity constraints in a database?
How can I see all tables in oracle?
What privilege is needed for a user to create tables in oracle?