ソースコード
select
    cast(avg(TOTAL_VALUE) as integer) as SA_MEDIAN
from
(
select
    TOTAL_VALUE
    ,row_number() over(partition by '' order by TOTAL_VALUE) as RN
    ,row_number() over(partition by '' order by TOTAL_VALUE)+0.5 as RN01
    ,row_number() over(partition by '' order by TOTAL_VALUE)-0.5 as RN02
from
    CONVENIENCE
where
    SURVEY_YEAR='2019'
    and KIND_CODE='100'
) SUB
where
    RN in (select count(*)/2 from CONVENIENCE where SURVEY_YEAR='2019' and KIND_CODE='100')
    or 
    RN01 in (select count(*)/2 from CONVENIENCE where SURVEY_YEAR='2019' and KIND_CODE='100')
    or
    RN02 in (select count(*)/2 from CONVENIENCE where SURVEY_YEAR='2019' and KIND_CODE='100')
提出情報
提出日時2022/12/11 14:34:41
コンテスト第4回 SQLコンテスト
問題中央値の算出
受験者1120011
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量80 MB
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
80 MB
データパターン2
WA
80 MB
データパターン3
WA
79 MB