Answer Posted / shikha
The DENSE_RANK function computes the rank of a row in an
ordered group of rows.Rows with equal values for the
ranking criteria receive the same rank.
For eg.
To Show the set of sales people who make the top 3
salaries - that is, find the set of distinct salary
amounts, sort them, take the largest three, and give me
everyone who makes one of those values.
SELECT * FROM (
SELECT deptno, ename, sal,
DENSE_RANK()
OVER (
PARTITION BY deptno ORDER BY sal desc
) TopN FROM emp
)
WHERE TopN <= 3
ORDER BY deptno, sal DESC
/
DEPTNO ENAME SAL TOPN
---------- ---------- ---------- ----------
10 KING 5000 1
CLARK 2450 2
MILLER 1300 3
20 SCOTT 3000 1 <--- ! (in
case of rank
JONES will have
3 and dense
rank will have 2)
FORD 3000 1 <--- !
JONES 2975 2
ADAMS 1100 3
30 BLAKE 2850 1
ALLEN 1600 2
30 TURNER 1500 3
| Is This Answer Correct ? | 11 Yes | 6 No |
Post New Answer View All Answers
How were the reports scheduled and how to resolve unexecuted documents?
What Is Snow Flake Schema?
Hi, What is the best answer for tell me about yourself for 2 years experience in bo developing.
Explain the difference between detect alias and detect context?
If I have three predefined prompts. In a report it will come randomly. How they will come in a specified format?
What is the difference between the public object&schema object?
When we use aggregate awareness function in designer?
Explain is data mart?
What is the functional & architectural differences between business objects and web intelligence reports?
What we need to discuss with designer before starting the universe designing.
How to execute the plsql procedure from the report by clicking with mouse?
How to do impact analysis for a change in Database field size which is assigned to a Dimension object and used in 10 universes
How to generate the report from excel sheet?
Give some information on report bursting?
What is the difference between absolute and relative div positioning?