강의

멘토링

커뮤니티

Inflearn Community Q&A

bug08271742's profile image
bug08271742

asked

SQL data analysis learned through various cases

Get DAU, WAU, MAU with SQL - 01

mau 구할때 group by 사용안해도 count 집계함수가 왜 가능한지 모르겠습니다.

Written on

·

247

0

웹 접속 및 사용분석 실습 1번 파일입니다.

 

select :current_date , count(distinct user_id) as dau

from ga_sess

where visit_stime >= (:current_date - interval '1 days') and visit_stime < :current_date.

 

위 코드의 count()는 왜 group by 없이도 작동하는 것인가요?

sqlpostgresqldbms/rdbms퍼포먼스-마케팅데이터-엔지니어링

Answer 1

0

dooleyz3525님의 프로필 이미지
dooleyz3525
Instructor

안녕하십니까,

group by 없이 aggregate 함수 적용이 가능합니다.

group by 가 없이 aggregation 함수를 수행하면 전체 테이블을 기준으로 aggregation을 적용하여 단 한건의 결과만 추출 됩니다.

감사합니다.

bug08271742's profile image
bug08271742

asked

Ask a question