ソースコード
SELECT
	PF_CODE as CODE
	, NAME
	, ROUND(CAST(inshu_num as REAL) / CAST(total_num as REAL), 2) as PERCENTAGE
FROM
	(
		SELECT
			a.PF_CODE
			, b.PF_NAME as NAME
			, SUM(CASE WHEN a.CATEGORY_CODE = '120' AND a.GENDER_CODE IN(2,3) THEN AMT ELSE 0 END)*100 as inshu_num
			, SUM(CASE WHEN a.CATEGORY_CODE = '110' AND a.GENDER_CODE IN(2,3) THEN AMT ELSE 0 END) as total_num
		FROM
			DRINK_HABITS as a
		INNER JOIN
			PREFECTURE as b
		ON
			a.PF_CODE = b.PF_CODE
		GROUP BY
			a.PF_CODE
			, NAME
	)
ORDER BY
	PERCENTAGE DESC
	, PF_CODE DESC
提出情報
提出日時2022/09/21 22:51:04
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者shinya_fujiwara
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量78 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
78 MB
データパターン2
WA
76 MB