일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- SSL
- 날짜
- exception
- JSTL
- maven
- @RequestBody
- 문자열
- 이클립스
- DB
- html
- switch
- 오라클
- RADIO
- HTML5
- 호환성
- 스크립트
- json
- null
- Oracle
- 전자정부 표준프레임워크
- java
- php
- jquery
- 웹 플랫폼 설치 관리자
- MYSQL
- 한글
- 네이버스마트 에디터
- 톰캣
- checbox
- spring form tag
- Today
- Total
개인적인 정리
[Oracle] NTILE() 본문
오라클 NTILE()
NTILE()
-
NTILE(expr) OVER (query_partition_clause order_by_clause)
의 형태
NTILE is an analytic function. It devides an ordered data set into a number of buckets indicated by expr and assigns the appropriate bucket number to each row. The buckets are numbered 1 throguh expr. The expr value must resolve to a positive constant for each partition. Oracle Database expects an integer, and if expr is noninteger constant, then Oracle truncates the value to an integer. The return value is NUMBER.
The number of rows in the buckets can differ by at most 1. The remainder values(the remainder of number of rows divided by buckets) are distrubuted one for each bucket, starting with bucket 1.
If expr is greater than the number of rows, then a number of buckets equal to the number of rows will be filled, and the remaining buckets will be empty.
You cannot nest analytic function by using NTILE or any other analytic function for expr. Howerer, you can use other built-in function expression for expr.
오라클 oe 계정으로 테스트 가능
SQL>
SELECT
last_name,
salary,
NTILE(4) OVER (ORDER BY salary DESC) as quarttile
FROM employees
WHERE department_id =100
ORDER BY last_name, salary, quarttile ;
'DB > ORACLE' 카테고리의 다른 글
[Oracle] NVL() (0) | 2020.04.13 |
---|---|
[Oracle] NUMTOYMINTERVAL() (0) | 2020.04.13 |
[Oracle]NUMTODSINTERVAL() (0) | 2020.04.13 |
[Oralce] NULLIF() (0) | 2020.04.13 |
[Oracle] NTH_VALUE() (0) | 2020.04.10 |
[Oracle] NEXT_DAY() (0) | 2020.04.10 |
[Oracle] NCHR() (0) | 2020.04.10 |
[Oracle] NANVL() (0) | 2020.04.10 |