Link to home
Start Free TrialLog in
Avatar of MIHIR KAR
MIHIR KARFlag for India

asked on

Oracle_Analytics

Hii experts i have a query...

dense_rank() over (parttition by 1 group by colunm_name)   ---what dose this syntax means where exactly it's uses .

Thanks in Advance
Avatar of PortletPaul
PortletPaul
Flag of Australia image

dense_rank() over (partition by column1_name order by column2_name)

DENSE_RANK computes the rank of a row in an ordered group of rows and returns the rank as a NUMBER . The ranks are consecutive integers beginning with 1. The largest rank value is the number of unique values returned by the query. Rank values are not skipped in the event of ties.
oracle docs

e.g.
Any person who gets 100% in a test would be ranked 1 (the highest place in class)
Any person who gets 0% in a test would be ranked the lowest in class

select
     person
    , dense_rank() over (partition by 1 order by exam_result DESC)  as class_rank
from exams
where class = 'year2016 economics'

------
"group by" is not valid within an OVER() clause
Avatar of MIHIR KAR

ASKER

Thaks a lot Paul .
I got clear with order by option ,but  i have doubt on how to use Group By on partition .
ASKER CERTIFIED SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial