ソースコード
SELECT p.PF_CODE AS CODE, p.PF_NAME AS NAME,
    (SELECT 
        ROUND
        ((SELECT SUM(d3.AMT)
        FROM DRINK_HABITS AS d3
        WHERE d3.CATEGORY_CODE = '120' AND d3.GENDER_CODE <> '1'
        AND d3.PF_CODE = p.PF_CODE
        )  * 100.0 / (SELECT SUM(d4.AMT)
        FROM DRINK_HABITS AS d4
        WHERE d4.CATEGORY_CODE = '110' AND d4.GENDER_CODE <> '1'
        AND d4.PF_CODE = p.PF_CODE
        ),1)
    FROM DRINK_HABITS AS d2
    WHERE p.PF_CODE = d2.PF_CODE) AS PERCENTAGE
FROM PREFECTURE AS p
WHERE PERCENTAGE IS NOT NULL
ORDER BY PERCENTAGE DESC, PF_CODE DESC
提出情報
提出日時2022/09/21 17:59:48
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者seiya592
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量95 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
95 MB
データパターン2
AC
89 MB