1) 집계함수 
 - count / sum / avg/ min / max

2) sample의 행의 개수 구하기
select count(*) from sample;
select count(*) from sample where name = 'B';

3) distinct로 중복 제거
select distinct name from sample;
select count(all name), count(distinct name) from sample;

4) sum으로 합계 구하기
select sum(quantity) from smaple

5) avg로 평균값 구하기
select avg(quantity), sum(quantity)/count(quantity) from sample;

6) min, max로 최솟값, 최댓값 구하기
select min(quantity), max(quantity), min(name), max(name) from sample;

+ Recent posts