ソースコード
select
    CUST_CODE as CODE,
    CUST_NAME as NAME,
    CNT as CNT,
    TTL_AMT as TTL_AMT,
    AVG_AMT as AVG_AMT
from
    (
    select
        TBL1.CUST_CODE,
        CUST_NAME,
        count(CUST_NAME) as CNT,
        sum(ORDER_AMNT) as TTL_AMT,
        round(avg(ORDER_AMNT)) as AVG_AMT
    from
        ORDERS as TBL1
    left outer join CUSTOMER as TBL2 on TBL1.CUST_CODE  = TBL2.CUST_CODE 
    where '2023-09-01' <= ORDER_DATE and ORDER_DATE <= '2023-09-30'
    group by TBL1.CUST_CODE,CUST_NAME
    ) as TBL3
where
    CNT >= 5
order by CNT desc,AVG_AMT desc,CODE asc
limit 5
提出情報
提出日時2023/12/15 13:55:47
コンテスト第10回 SQLコンテスト
問題優良顧客
受験者M_ENDO
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量88 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
88 MB
データパターン2
AC
86 MB