ソースコード
with SCHOOL_HEALTH_H as(
    select
        AGE,
        GENDER_CODE,
        AVERAGE_VALUE as H
    from
        SCHOOL_HEALTH
    where
        SURVEY_YEAR = 2019
    and CATEGORY_CODE = '10'
    
), SCHOOL_HEALTH_W as(
    select
        AGE,
        GENDER_CODE,
        AVERAGE_VALUE as W
    from
        SCHOOL_HEALTH
    where
        SURVEY_YEAR = 2019
    and CATEGORY_CODE = '20'
    
), SCHOOL_HEALTH_HW as(
    select
        h.AGE,
        h.GENDER_CODE,
        H,
        W
    from
        SCHOOL_HEALTH_H h
    join
        SCHOOL_HEALTH_W w
    on
        h.AGE = w.AGE
    and h.GENDER_CODE = w.GENDER_CODE
)

select
    AGE     as AGE,
    case GENDER_CODE
        when '20' then 'MALE'
        when '30' then 'FEMALE'
        end as GENDER,
    round(avg(H), 1) as H_AVG,
    -- 身長平均値以上の割合 as H_PER
    round(avg(W), 1) as W_AVG
    -- 体重平均値以上の割合 as W_PER
from
    SCHOOL_HEALTH_HW
group by
    AGE,
    GENDER_CODE
order by
    AGE         desc,
    GENDER_CODE desc
提出情報
提出日時2023/08/21 11:39:20
コンテスト第8回 SQLコンテスト
問題身長と体重
受験者mayu.s
状態 (詳細)TLE
(Time Limit Exceeded: 時間制限オーバー)
メモリ使用量104 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
103 MB
データパターン2
TLE
104 MB