i need department wise top 2 employees salary.which logic
i will use
Answer Posted / ashok kumar y
SELECT a.deptno, a.sal
FROM (SELECT deptno, sal,
DENSE_RANK () OVER (PARTITION BY deptno ORDER BY sal DESC NULLS LAST) max_sal
FROM emp
WHERE deptno IS NOT NULL) a
WHERE max_sal <= 2 group by deptno,sal ;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain what is sql*plus?
Does a user_objects view have an entry for a trigger?
How you improve the performance of sql*loader? : aql loader
Why do we go for stored procedures?
Show the two pl/sql cursor exceptions.
What is the function that is used to transfer a pl/sql table log to a database table?
What is a unique key?
What are sql procedures?
What is cursor and its types?
What are triggers and its uses?
Can we use joins in subquery?
Which command is used to delete a trigger?
Explain the insert into statements in sql?
What is ttitle and btitle?
Can you select everything, but 1 or 2 fields, without writer's cramp?