COUNT
SUM
AVG
합계를 반환합니다.
SUM(expr)
아래 값을 입력하면 예제에 즉시 반영됩니다.
customer_id
total_amount
total_spent
orders
-- 고객별 누적 주문 금액 SELECT customer_id, SUM(total_amount) AS total_spent FROM orders GROUP BY customer_id ORDER BY total_spent DESC;