ソースコード
WITH
wk_order(CUST_CODE, ordercount, orderamount)
AS
 (
 SELECT
  CUST_CODE
  ,count(ORDER_NO) as ordercount
  ,sum(ORDER_AMNT) as orderamount
 FROM
  ORDERS
 WHERE
  ORDER_DATE BETWEEN '2023-09-01' AND '2023-09-30'
 GROUP BY
  CUST_CODE
 HAVING
  ordercount >= 5
 )

SELECT
 wk_order.CUST_CODE as CODE
 ,CUST_NAME as NAME
 ,ordercount as CNT
 ,orderamount as TTL_AMT
 ,round((orderamount/ordercount),1) as AVG_AMT
FROM
 wk_order
 inner join
 CUSTOMER
 on wk_order.CUST_CODE = CUSTOMER.CUST_CODE
ORDER BY
 CNT desc
 ,AVG_AMT desc
 ,CODE asc
LIMIT 5
提出情報
提出日時2023/12/18 09:50:07
コンテスト第10回 SQLコンテスト
問題優良顧客
受験者na1216
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量97 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
97 MB
データパターン2
AC
97 MB