group by/ count(*)
select name, count(*) from users
group by name
최소값(min)
select week, min(likes) from checkins
group by week
최대값(max)
select week, max(likes) from checkins
group by week
평균(avg), 소수점(round)
select week, round(avg(likes),2) from checkins
group by week
합계(sum)
select week, sum(likes) from checkins
group by week
오름차순(asc) 정렬(order by)
select name, count(*) from users
group by name
order by count(*)
내림차순(desc)
select * from checkins
order by likes desc
응용
select payment_method, count(*) from orders
where course_title ='웹개발 종합반'
group by payment_method
order by count(*)
Alias
select payment_method, count(*) as cnt FROM orders o
where o.course_title ="앱개발 종합반"
group by payment_method