ソースコード

SELECT
    S1.CODE as CODE,
    S1.NAME as NAME,
    ROUND(cast(S2.AMT as REAL)/cast(S1.AMT as REAL)*100,1) as PERCENTAGE
FROM
    (SELECT
    T1.PF_CODE as CODE,
    PR.PF_NAME as NAME,
    T1.CATEGORY_CODE,
    AMT
FROM
    DRINK_HABITS as T1
    inner join PREFECTURE as PR
    on T1.PF_CODE = PR.PF_CODE
WHERE
        T1.GENDER_CODE in (2,3) AND
        T1.CATEGORY_CODE = 110
GROUP BY
    PR.PF_CODE,
    T1.CATEGORY_CODE
) as S1
inner join (SELECT
    T1.PF_CODE as CODE,
    PR.PF_NAME as NAME,
    T1.CATEGORY_CODE,
    AMT
FROM
    DRINK_HABITS as T1
    inner join PREFECTURE as PR
    on T1.PF_CODE = PR.PF_CODE
WHERE
        T1.GENDER_CODE in (2,3) AND
        T1.CATEGORY_CODE = 120
GROUP BY
    PR.PF_CODE,
    T1.CATEGORY_CODE
) as S2
on S1.CODE = S2.CODE

ORDER BY
    PERCENTAGE DESC,
    CODE DESC
提出情報
提出日時2024/05/30 00:22:01
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者Kali
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
85 MB
データパターン2
WA
83 MB