ソースコード
SELECT
 DH110.PF_CODE AS CODE
 , PR.PF_NAME AS NAME
 , ROUND(100.0 * DH120.TOTAL_AMT / DH110.TOTAL_AMT, 1) AS PERCENTAGE
FROM 
 (SELECT PF_CODE, SUM(AMT) AS TOTAL_AMT FROM DRINK_HABITS WHERE CATEGORY_CODE = '110' AND GENDER_CODE IN ('2', '3') GROUP BY PF_CODE ) DH110
INNER JOIN
 (SELECT PF_CODE, SUM(AMT) AS TOTAL_AMT FROM DRINK_HABITS WHERE CATEGORY_CODE = '120' AND GENDER_CODE IN ('2', '3') GROUP BY PF_CODE ) DH120
ON DH120.PF_CODE = DH110.PF_CODE
INNER JOIN PREFECTURE PR
ON DH110.PF_CODE = PR.PF_CODE
ORDER BY PERCENTAGE DESC, DH110.PF_CODE DESC
提出情報
提出日時2024/11/06 11:33:56
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者nmanh
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量87 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
87 MB
データパターン2
AC
85 MB