ソースコード
SELECT
	SUM_AMT.PF_CODE AS CODE,
	P.PF_NAME  AS NAME,
	SUM_DRINK.D_AMT , SUM_AMT.AMT ,
	ROUND(CAST(SUM_DRINK.D_AMT AS REAL) / CAST(SUM_AMT.AMT AS REAL) * 100.0, 1) AS PERCENTAGE
FROM
	(SELECT PF_CODE, SUM(AMT) AS AMT  FROM DRINK_HABITS WHERE GENDER_CODE IN ('2', '3') AND CATEGORY_CODE = '110' GROUP BY PF_CODE) AS SUM_AMT
	LEFT JOIN 
	(SELECT PF_CODE, SUM(AMT) AS D_AMT FROM DRINK_HABITS WHERE GENDER_CODE IN ('2', '3') AND CATEGORY_CODE = '120' GROUP BY PF_CODE) AS SUM_DRINK
	ON SUM_AMT.PF_CODE = SUM_DRINK.PF_CODE
	LEFT JOIN PREFECTURE P
	ON SUM_AMT.PF_CODE = P.PF_CODE
ORDER BY
	PERCENTAGE DESC,
	CODE DESC
提出情報
提出日時2022/09/21 16:22:25
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者tanaka
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量96 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
95 MB
データパターン2
WA
96 MB