728x90
1. 집합 함수 (Aggregate Functions)
1) avg 함수
select avg(salary) from employees;
select employee_id, department_id, salary,
RAOUND(AVG(salary) OVER (PARTITION BY department_id),0) "AvgByDeptid"
from employees
where department_id IN (10,20,30)
2) rank 함수
select rank(3000) whthin group(order by salary desc) "rank" from employees;
select emplyee_id, salary, rank() over (order by salary) "rank" from employees;
3) sum, min, max, count 함수
2. 분석함수
1) first_value 함수
select employee_id, salary,
FIRST_VALUE(salary)
OVER(PARTITION BY department_id ORDER BY salary DESC)
"Highsal_Departmentid"
from employees;
2)count 함수
3) sum 함수
728x90
'database > oracle' 카테고리의 다른 글
| proc 예외처리 (09.09.15) (0) | 2025.05.19 |
|---|---|
| 시퀀스 (2009.09.14) (0) | 2025.05.10 |
| plan_table (2008.07.12 ) (0) | 2025.05.10 |
| FLASHBACK TABLE (2008.06.27) (0) | 2025.05.10 |
| 오라클 계정 생성(12G 주의점 추가) (08.02.18) (0) | 2025.05.10 |