ソースコード
SELECT
    X.CODE AS CODE,
    X.NAME AS NAME,
    X.TOTAL_AMT AS TOTAL_AMT
FROM (
    SELECT
        C.ITEM_CODE AS CODE,
        C.ITEM_NAME AS NAME,
        SUM(B.UNITPRICE * B.ORDER_QTY) AS TOTAL_AMT,
        RANK() OVER (ORDER BY SUM(B.UNITPRICE * B.ORDER_QTY) DESC, C.ITEM_CODE DESC) AS RANK_NO
    FROM ORDERS A
    INNER JOIN ORDERS_DTL B
    ON A.ORDER_NO = B.ORDER_NO
    INNER JOIN ITEM C
    ON B.ITEM_CODE = C.ITEM_CODE
    WHERE A.ORDER_DATE >= '2023-05-14'
    AND A.ORDER_DATE <= '2023-05-20'
    GROUP BY C.ITEM_CODE, C.ITEM_NAME
    ORDER BY TOTAL_AMT DESC, C.ITEM_CODE DESC
) X
WHERE X.RANK_NO <= 5
提出情報
提出日時2023/06/19 01:00:59
コンテスト第7回 SQLコンテスト
問題受注金額TOP5
受験者tayutayu2561
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量81 MB
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
81 MB
データパターン2
AC
78 MB
データパターン3
AC
78 MB