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 online transaction processing (oltp)? : Sql dba
What are sql*plus environment variables?
Is it mandatory for the primary key to be given a value when a new record is inserted?
What are the disadvantages of not performing database normalization?
what are the 'mysql' command line options? : Sql dba
what is bcp? When does it used? : Sql dba
What is sql procedures and functions?
What is the difference between a procedure and a function?
What is pl sql and why it is used for?
how to create a new table in mysql? : Sql dba
How do I add a database to sql?
What is nosql db?
Explain raise_application_error.
Is it possible to create startup or shutdown trigger for on-schema?
How to display Row Number with Records in Oracle SQL Plus?