ソースコード
SELECT 
     DH1.PF_CODE AS CODE
    ,PR.PF_NAME AS NAME
    , ROUND( 
        CAST(DH1.EVERY_ALL AS REAL) / CAST(DH2.'ALL' AS REAL) * 100
        ,1
    )  AS PERCENTAGE 
FROM (
    SELECT 
         PF_CODE
        ,SUM(AMT) AS 'EVERY_ALL' 
    FROM DRINK_HABITS
    WHERE GENDER_CODE IN ('2','3')
    AND CATEGORY_CODE = '120'
    GROUP BY PF_CODE
) AS DH1
INNER JOIN (
    SELECT 
         PF_CODE
        ,SUM(AMT) AS 'ALL' 
    FROM DRINK_HABITS
    WHERE GENDER_CODE IN ('2','3')
    GROUP BY PF_CODE
) AS DH2
ON DH1.PF_CODE = DH2.PF_CODE
INNER JOIN PREFECTURE PR
    ON DH1.PF_CODE = PR.PF_CODE
ORDER BY 
    PERCENTAGE DESC
    ,CODE DESC
提出情報
提出日時2022/09/21 19:31:29
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者n_takeda
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量105 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
105 MB
データパターン2
WA
105 MB