ソースコード
WITH DRINK as (SELECT 
SUM(CASE WHEN CATEGORY_CODE = '110' THEN AMT ELSE 0 END) AS TOTAL_NUM,
SUM(CASE WHEN CATEGORY_CODE = '120' THEN AMT ELSE 0 END) AS DRINK_NUM,
PF_CODE
FROM DRINK_HABITS
WHERE GENDER_CODE = '2' OR GENDER_CODE = '3'
GROUP BY PF_CODE)

SELECT PF.PF_CODE AS CODE,
PF_NAME AS NAME,
ROUND((CAST(DRINK_NUM AS REAL) / CAST(TOTAL_NUM AS REAL)) * 100, 1) as PERCENTAGE
FROM DRINK
JOIN PREFECTURE AS PF
ON DRINK.PF_CODE = PF.PF_CODE
ORDER BY PERCENTAGE DESC
提出情報
提出日時2022/09/21 16:18:28
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者matsushiman
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量96 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
95 MB
データパターン2
AC
96 MB