ソースコード
SELECT
    DRINK.PF_CODE AS CODE
    , PF_NAME AS NAME
    , ROUND (( CAST(DRINK.AMT AS REAL) / CAST(ALL_AMOUT.AMT AS REAL)) * 100, 1) AS PERCENTAGE
FROM
    (SELECT
        SUM(AMT) AS AMT
        , PF_CODE
    FROM
        DRINK_HABITS
    WHERE
        CATEGORY_CODE = '120'
        AND GENDER_CODE IN ('2', '3')
    GROUP BY
        PF_CODE
    ) AS DRINK
    INNER JOIN 
        (SELECT
            SUM(AMT) AS AMT
            , PF_CODE
        FROM
            DRINK_HABITS
        WHERE
            CATEGORY_CODE = '110'
            AND GENDER_CODE IN ('2', '3')
        GROUP BY
            PF_CODE
        ) AS ALL_AMOUT
        ON DRINK.PF_CODE = ALL_AMOUT.PF_CODE
    INNER JOIN PREFECTURE AS PF
        ON DRINK.PF_CODE = PF.PF_CODE

ORDER BY
    PERCENTAGE DESC
    , CODE
提出情報
提出日時2022/09/21 19:19:32
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者peter-yusuke
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量105 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
105 MB
データパターン2
AC
105 MB