ソースコード
with
	z as
		(select
			pf_code
			,sum(amt) as amt
		from
			drink_habits
		where
			gender_code in (2, 3)
		group by
			1
		)
	,m as
		(select
			pf_code
			,sum(amt) as amt
		from
			drink_habits
		where
			gender_code in (2, 3)
			and category_code = 120
		group by
			1
		)

select
	p.pf_code as code
	,p.pf_name as name
	,round(cast(m.amt as real) * 100 / cast(z.amt as real), 2) as percentage
from
	prefecture p
	join
		z
		on
			p.pf_code = z.pf_code
	join
		m
		on
			p.pf_code = m.pf_code
order by
	3 desc, 1 desc
提出情報
提出日時2022/09/21 18:11:42
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者takahirostone
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量95 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
95 MB
データパターン2
WA
95 MB