ソースコード
select
    a.age,
    case
        when a.gender_code = 20 then 'MALE'
        when a.gender_code = 30 then 'FEMALE'
        else null end as "GENDER",
    round(avg(case when a.category_code = 10 and a.average_value > b.average_value then a.average_value else null end), 1) as "H_AVG",
    round(100 * cast(sum(case when a.category_code = 10 and a.average_value > b.average_value then 1 else null end) as numeric)
    / cast(sum(case when a.category_code = 10 then 1 else null end) as numeric), 1) as "H_PER",
    
    round(avg(case when category_code = 20 and a.average_value > b.average_value then a.average_value else null end), 1) as "W_AVG",
    round(100 * cast(sum(case when category_code = 20 and a.average_value > b.average_value then 1 else null end) as numeric)
    / cast(sum(case when category_code = 20 then 1 else null end) as numeric), 1) as "W_PER"
    
    
    
from school_health as a
inner join (
    select
        category_code,
        gender_code,
        age,
        round(avg(average_value), 1) as average_value
    from school_health
    where survey_year = 2019
    group by 1, 2, 3) as b
using(category_code, gender_code, age)
group by 1, 2
order by 1 desc, a.gender_code desc
提出情報
提出日時2023/08/21 10:07:56
コンテスト第8回 SQLコンテスト
問題身長と体重
受験者miotsukushi0800
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量100 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
100 MB
データパターン2
WA
98 MB