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 a pl sql block be executed?
How you improve the performance of sql*loader? : aql loader
What is the purpose of the partition table?
Is sql easier than java?
How to start oracle sql developer?
What are the built in functions of sql?
What is the difference between distinct and unique in sql?
how to create a new table in mysql? : Sql dba
Explain how you can copy a file to file content and file to pl/sql table in advance pl/sql?
What is the maximum number of rows in sql table?
How many clustered indexes can be created on a table?
Does truncate release storage space?
Is and as keyword in pl sql?
Write the alter statement to enable all the triggers on the t.students table.
Does sql full backup truncate logs?