ソースコード
with
total_people as(
select
    PF_CODE, AMT
from
    DRINK_HABITS
where
    CATEGORY_CODE = 110
group by
    PF_CODE
)

, drink_everyday as(
select
    PF_CODE, AMT
from
    DRINK_HABITS
where
    CATEGORY_CODE = 120
group by
    PF_CODE
)

select
    pf.PF_CODE as CODE
    , PF_NAME as NAME
    , round(cast(de.AMT as real) / cast(tp.AMT as real) * 100, 2) as PERCENTAGE
from
    PREFECTURE as pf
    join total_people as tp
    on pf.PF_CODE = tp.PF_CODE
    join drink_everyday as de
    on pf.PF_CODE = de.PF_CODE
order by
    PERCENTAGE desc, CODE desc
提出情報
提出日時2022/12/28 14:49:45
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者2takumax
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量78 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
78 MB
データパターン2
WA
77 MB