ソースコード
with population as (
    select
        sum(case when gender_code in ('2', '3') and category_code = '110' then amt else 0 end) as total_population,
        sum(case when gender_code in ('2', '3') and category_code = '120' then amt else 0 end) as drink_population,
        pf_code
    from
        drink_habits
    group by
        pf_code
)
select
    population.pf_code as code,
    prefecture.pf_name as name,
    round(1.0 * population.drink_population / population.total_population * 100, 1) as percentage
from
    population
inner join
    prefecture
    on prefecture.pf_code = population.pf_code
order by
    percentage desc,
    code desc
;
提出情報
提出日時2022/12/11 12:52:51
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者tekihei2317
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量79 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
79 MB
データパターン2
WA
78 MB