ソースコード
with t1 as (
    select total_value,
        row_number() over(order by total_value) as n,
        count(*) over win as n_max
    from convenience
    window win as (order by total_value rows between UNBOUNDED PRECEDING and UNBOUNDED FOLLOWING)
),
t2 as (
    select
        case when n_max % 2 = 0
            then round(cast(nth_value(total_value, n_max / 2) over win + nth_value(total_value, n_max / 2 + 1) over win as real) / 2.0)
            else nth_value(total_value, n_max / 2 + 1) over win
        end as sm
    from t1
    window win as (order by total_value rows between UNBOUNDED PRECEDING and UNBOUNDED FOLLOWING)
)
select max(sm) as SA_MEDIAN
from t2
提出情報
提出日時2022/12/10 21:59:38
コンテスト第4回 SQLコンテスト
問題中央値の算出
受験者tera_3939
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量76 MB
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
76 MB
データパターン2
WA
76 MB
データパターン3
WA
76 MB