ソースコード
WITH t1 AS (
    SELECT
        PF_CODE, SUM(AMT) AS total1
    FROM
        DRINK_HABITS
    INNER JOIN
        PREFECTURE USING (PF_CODE)
    WHERE
        CATEGORY_CODE = 110
        AND GENDER_CODE IN (1, 2)
    GROUP BY
        PF_CODE
),
t2 AS (
    SELECT
        PF_CODE, SUM(AMT) AS total2
    FROM
        DRINK_HABITS
    INNER JOIN
        PREFECTURE USING (PF_CODE)
    WHERE
        CATEGORY_CODE = 120
        AND GENDER_CODE IN (1, 2)
    GROUP BY
        PF_CODE
)
SELECT
    PF_CODE AS CODE,
    PF_NAME AS NAME,
    ROUND(CAST(total2 AS real) / CAST(total1 AS real) * 100, 2) AS PERCENTAGE
FROM
    t1
INNER JOIN
    t2 USING (PF_CODE)
INNER JOIN
    PREFECTURE USING (PF_CODE)
ORDER BY
    ROUND(CAST(total2 AS real) / CAST(total1 AS real) * 100, 2) DESC,
    PF_CODE
提出情報
提出日時2022/09/22 09:40:44
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者ikd
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量95 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
95 MB
データパターン2
WA
92 MB