ソースコード
with drink_everyday as(
    select 
        CATEGORY_CODE, 
        GENDER_CODE, 
        PF_CODE, 
        AMT
    from DRINK_HABITS
    where CATEGORY_CODE = '120' and GENDER_CODE in (2, 3)
), 
    drink_all as(
        select 
        CATEGORY_CODE, 
        GENDER_CODE, 
        PF_CODE, 
        AMT
    from DRINK_HABITS
    where CATEGORY_CODE = '110' and GENDER_CODE in (2, 3)
) 
select 
    p.PF_CODE as CODE, 
    p.PF_NAME as NAME, 
    round(100 * cast(de.amt as real) / cast(da.amt as real) , 1) as PERCENTAGE
from drink_everyday as de
    inner join drink_all as da on de.PF_CODE = da.PF_CODE and de.GENDER_CODE = da.GENDER_CODE
    inner join PREFECTURE as p on de.PF_CODE = p.PF_CODE
order by PERCENTAGE desc, code desc
;
提出情報
提出日時2023/10/31 13:54:16
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者fgdthfjgh
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量78 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
78 MB
データパターン2
WA
74 MB