ソースコード
WITH RANK_AMOUNT AS
(
    SELECT
        RANK() OVER(ORDER BY TOTAL_VALUE DESC) AS RANK,
        TOTAL_VALUE
    FROM
        CONVENIENCE
    WHERE
        SURVEY_YEAR = 2019
),
RANK_POINT AS
(
    SELECT
        CASE WHEN MOD(MAX(RANK), 2) = 0 THEN MAX(RANK) / 2
             ELSE MAX(RANK) / 2
        END AS SU_1,
        CASE WHEN MOD(MAX(RANK), 2) = 0 THEN MAX(RANK) / 2 + 1
             ELSE MAX(RANK) / 2
        END AS SU_2
    FROM
        RANK_AMOUNT
)
SELECT
    (RANK_1.TOTAL_VALUE + RANK_2.TOTAL_VALUE) / 2 AS SA_MEDIAN
FROM
    RANK_POINT
    INNER JOIN
    RANK_AMOUNT AS RANK_1
    ON RANK_POINT.SU_1 = RANK_1.RANK
    INNER JOIN
    RANK_AMOUNT AS RANK_2
    ON RANK_POINT.SU_2 = RANK_2.RANK
;
提出情報
提出日時2022/12/09 18:27:18
コンテスト第4回 SQLコンテスト
問題中央値の算出
受験者hiro200261
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量94 MB
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
79 MB
データパターン2
WA
81 MB
データパターン3
WA
94 MB