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
List the various privileges that a user can grant to another user?
Do stored procedures prevent sql injection?
Does asenumerable execute the query?
how are mysql timestamps seen to a user? : Sql dba
What is sqlcommand?
What types of commands can be executed in sql*plus?
what is bdb (berkeleydb)? : Sql dba
What is rename command in sql?
what is not null constraint? : Sql dba
Is sql pronounced sequel or sql?
What is the syntax to add a record to a table?
How do I save the results of sql query in a file?
how to include numeric values in sql statements? : Sql dba
Which command is used to delete a trigger?
Explain alias in sql?