본문 바로가기
Work | 업무/데이터분석

[SQL 스터디] 7일차 GROUPING, GROUP BY, HAVING

by 1theBoy 2020. 3. 8.
반응형

 

GROUP BY: 동일한 데이터 값 별로 묶어서 보여줌

SELECT SUM(salary)
FROM employees
GROUP BY department;

HAVING: 필터값에 조건을 적용하는 절

SELECT department, COUNT(*)
FROM employees
GROUP BY department
HAVING count(*) < 35
ORDER BY department

반응형

댓글