ソースコード
SELECT
    NO
    , TTL_SAL
    , ROUND(CAST(TTL_SAL AS FLOAT) * 100 / TOTAL_SAL, 1) AS PER_SAL
    , ROUND(CAST(SUM(TTL_SAL) OVER(ORDER BY NO) AS FLOAT) * 100 / TOTAL_SAL, 1) AS CUM_SAL
    , TTL_SAL / TTL_STR AS AVG_SAL
FROM
    (
        SELECT
            GROUP_NO AS NO
            , SUM(SAL) AS TTL_SAL
            , SUM(STR) AS TTL_STR
            , TOTAL_SAL
        FROM
            (
                SELECT
                    PF_CODE
                    , SAL
                    , STR
                    , FLOOR(((ROW_NUMBER() OVER (ORDER BY SAL DESC, PF_CODE)) - 1) / 3) + 1 AS GROUP_NO
                    , SUM(SAL) OVER() AS TOTAL_SAL
                FROM
                    (
                        SELECT
                            PF_CODE
                            , SUM(CASE WHEN KIND_CODE = 100 THEN TOTAL_VALUE ELSE 0 END) AS SAL
                            , SUM(CASE WHEN KIND_CODE = 150 THEN TOTAL_VALUE ELSE 0 END) AS STR
                        FROM 
                            CONVENIENCE
                        WHERE
                            SURVEY_YEAR = '2019'
                        GROUP BY
                            PF_CODE
                    )
            )
        GROUP BY
            GROUP_NO
    )
ORDER BY
    NO
;
提出情報
提出日時2023/11/11 16:40:30
コンテスト第9回 SQLコンテスト
問題販売額分析
受験者naku6aru
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量83 MB
メッセージ
テストケース(通過数/総数)
2/3
状態
メモリ使用量
データパターン1
AC
83 MB
データパターン2
AC
83 MB
データパターン3
WA
83 MB