Answer Posted / divakarreddy
SQL> select *from (select ename,sal,deptno,rank()
2 over(partition by deptno order by sal desc)topsal
3 from emp)
4 where topsal<=3
5 order by deptno,sal desc;
ENAME SAL DEPTNO TOPSAL
---------- ---------- ---------- ----------
KING 5000 10 1
MILLER 3000 10 2
CLARK 2450 10 3
SCOTT 3000 20 1
JONES 2975 20 2
ADAMS 1100 20 3
BLAKE 2850 30 1
ALLEN 1600 30 2
TURNER 1500 30 3
9 rows selected.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How can we solve sql error: ora-00904: invalid identifier?
which command using query analyzer will give you the version of sql server and operating system? : Sql dba
Is sql harder than python?
What is the most common sql injection tool?
What is break?
What is rowtype?
What is the difference between left and left outer join?
What are database links used for?
Does sqlite need a server?
What is an oracle stored procedure?
Are there any features that are decommissioned in 11g that are not present in 11g?
What do you mean by table in sql?
what is heap table? : Sql dba
Can we use view in stored procedure?
How do I edit a trigger in sql developer?