일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- checbox
- spring form tag
- 날짜
- SSL
- 네이버스마트 에디터
- 톰캣
- 한글
- null
- 스크립트
- 오라클
- java
- 문자열
- html
- HTML5
- 호환성
- switch
- exception
- 이클립스
- 웹 플랫폼 설치 관리자
- maven
- php
- JSTL
- RADIO
- 전자정부 표준프레임워크
- Oracle
- @RequestBody
- json
- jquery
- MYSQL
- DB
- Today
- Total
개인적인 정리
ORACLE DENSE_RANK() 본문
오라클 DENSE_RANK()
- 순위를 정하기 좋은 함수 같다. 그룹내에 정렬된 데이타의 순위를 매기기 좋은 함수 정도 ??
Aggregate Syntax
생략
Analytic Syntax
DENSE_RANK() OVER(PARTION BY ~~~ ORDER BY ~~~)
DENSE_RANK computes the rank of row in an ordered group of rows and returns the rank as a NUMBER. Then ranks are consecutive integers beginning with 1. The larget rank value is the number of unique values returned by the queyr. Rank values are not skipped in the event of ties. Rows with equal values for the ranking criteria receive the same rank. This function is useful for top-N and bottom-N reporting.
This function accepts as arguments any numeric data type and returns NUMBER.
- As an aggregate function, DENSE_RANK calculates the dense rank of a hypothetical row identified by the arguments of the function with respect to a given sort specification. The arguments of the function must all evaluage to constant expressions within each aggregate group, because they identify a single row within each grou. The constant argument expressions and the expression in the order_by_clause of the aggregate match by position. Therefore, the number of arguments must be the same and types must be compatible.
- As an analytic function DENSE_RANK computes the rank of each row returned form a query with respect to the other rows, based on the values of the value_exprs in the order_by_caluse.
Aggregate Example
SQL > SELECT DENSE_RANK(15500, 0.5) WITHIN GROUP (ORDER BY salary desc, commission_pct) from employees ;
--> 3
Analytic Example
SQL> SELECT employee_id, department_id, last_name, salary, DENSE_RANK() OVER(PARTITION BY department_id ORDER BY SALARY) AS DENSE_RANK
FROM employees
WHERE department_id=20 ;
--> 202 20 Fay 6000 1
201 20 Hartstein 13000 2
RANK() 와 조금 다르다.
https://web-obj.tistory.com/433
'DB > ORACLE' 카테고리의 다른 글
ORACLE FIRST() (0) | 2020.03.30 |
---|---|
ORACLE EXTRACT() (0) | 2020.03.30 |
ORACLE EXP() (0) | 2020.03.30 |
ORACLE EMPTY_BLOB(), EMPTY_CLOB() (0) | 2020.03.30 |
ORACLE DELETEXML() (0) | 2020.03.26 |
ORACLE DECODE() (0) | 2020.03.26 |
ORACLE CURRENT_TIMESTAMP() (0) | 2020.03.26 |
ORACLE CURRENT_DATE() (0) | 2020.03.26 |