Menu
Coddy logo textTech

요약 - 우수 고객

Coddy SQL 여정의 심화 과정 섹션에 포함된 레슨 — 27개 중 27번째.

challenge icon

챌린지

중급

사용 가능한 테이블과 컬럼:

  • <strong>orders</strong>: <strong>id</strong>, <strong>customer_id</strong>, <strong>amount</strong>, <strong>status</strong>

status = 'paid'인 주문만 고려하여, 각 customer_id에 대해 다음을 반환하세요:

  • customer_id
  • total_spent: amount의 합계
  • pct_of_revenue: 전체 결제 수익(paid revenue)에서 해당 고객이 차지하는 비율로, 소수점 첫째 자리에서 반올림

total_spent를 기준으로 내림차순 정렬하세요.

직접 해보기

-- 고객별 결제 주문 집계; 전체 대비 백분율 계산

심화 과정의 모든 레슨