hive sql - 다양한 group by - grouping sets , with cube
2022. 5. 1. 21:25ㆍData Analysis
select A,B,C, count(distinct cust_id)
from dataset
group by A,B,C
1. grouping sets
select A,B,C, grouping__id, count(distinct cust_id)
from dataset
group by A,B,C
grouping sets ((),(A),(B),(C),(A,C),(B,C),(A,B,C))
2. cube
select A,B,C, grouping__id, count(distinct cust_id)
from dataset
group by A,B,C
with cube
3. roll up
select A,B,C, grouping__id, count(distinct cust_id)
from dataset
group by A,B,C
with rollup
'Data Analysis' 카테고리의 다른 글
탐색적 데이터 분석 - 선형 PCA, 비선형 PCA (1) | 2024.06.13 |
---|---|
Skewness 비대칭도 (0) | 2022.05.26 |
정규표현식 예제 (0) | 2022.01.06 |
시퀀스 데이터 마이닝 Sequential Data Mining (0) | 2021.08.31 |
Data-deiven attribution modeling explained (0) | 2020.06.16 |