sql
집계함수(윈도우 함수)
임이레
2024. 8. 12. 12:40
기본 윈도우 함수 형식
| 함수() over (partition by order by) as 컬럼 이름
1. 전체적으로 더할 때
sum() over () as total_column
그러나 행에다가 윈도우 함수를 붙여주기 때문에 많은 행이 출력 되어 버린다. (필요에 맞게 사용)
2. partition by 를 쓰는 경우
sum() over(partition by column1 order by column 3) as 컬럼 이름
-> partition by 안에서 값을 계산