ソースコード
with t as (
    select
        t.PF_CODE
        ,p.PF_NAME
        ,SUM(t.AMT) as total
    from
        DRINK_HABITS as t
    inner join PREFECTURE as p
        on t.PF_CODE = p.PF_CODE 
    group by
        t.PF_CODE
), d as (
    select
        PF_CODE
        ,SUM(AMT) as sum
    from
        DRINK_HABITS
    where
        CATEGORY_CODE = '120'
        and GENDER_CODE in ('2','3')
    group by
        PF_CODE
)

select
    t.PF_CODE as CODE
    ,t.PF_NAME as NAME
    ,round(cast(d.sum AS REAL) /cast(t.total AS REAL) ,2) as PERCENTAGE
from
    t
inner join d
    on t.PF_CODE = d.PF_CODE
order by
    PERCENTAGE desc
    ,t.PF_CODE desc
提出情報
提出日時2023/07/05 16:28:09
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者mywk
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
84 MB
データパターン2
WA
81 MB