ソースコード
SELECT P_ALL.CODE, P_ALL.NAME, (P_ALL.ALL_AMT*100/T_ALL.ALL_AMT) AS PERCENTAGE FROM
(
    SELECT
        P.PF_CODE AS "CODE",
        PF_NAME AS "NAME",
        SUM(AMT) AS ALL_AMT
    FROM
        DRINK_HABITS AS D
        INNER JOIN PREFECTURE AS P
        ON P.PF_CODE = D.PF_CODE
    WHERE
      CATEGORY_CODE = '110'
      AND GENDER_CODE IN('2', '3')
    GROUP BY
      P.PF_CODE,PF_NAME
) T_ALL
INNER JOIN
(
    SELECT
        P.PF_CODE AS "CODE",
        PF_NAME AS "NAME",
        SUM(AMT) AS ALL_AMT
    FROM
        DRINK_HABITS AS D
        INNER JOIN PREFECTURE AS P
        ON P.PF_CODE = D.PF_CODE
    WHERE
      CATEGORY_CODE = '120'
      AND GENDER_CODE IN('2', '3')
    GROUP BY
      P.PF_CODE,PF_NAME
) P_ALL
ON P_ALL.CODE = T_ALL.CODE
ORDER BY
PERCENTAGE DESC, P_ALL.CODE DESC
;
提出情報
提出日時2022/09/21 21:10:46
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者suzuki_osamu
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量101 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
101 MB
データパターン2
WA
100 MB