ソースコード
select 
d2.pf_code as "CODE"
,p.pf_name as "NAME"
,round(round(cast(d2.drink_amt as real))/round(cast(dall.all_amt as real)) *100 ,1)  as "PERCENTAGE"
from 
(select d.pf_code 
,sum(d.amt) as "drink_amt"
from drink_habits d
where 
d.category_code = 120
and d.gender_code in (2,3)
group by d.pf_code
) d2
,prefecture p
,(select d.pf_code 
,sum(d.amt) as "all_amt"
from drink_habits d
where
d.category_code = 110
and d.gender_code in (2,3)
group by d.pf_code
) dall
where d2.pf_code = p.pf_code
and d2.pf_code = dall.pf_code
order by "PERCENTAGE" desc,p.pf_code desc
提出情報
提出日時2022/09/22 08:18:09
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者red3
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量91 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
91 MB
データパターン2
AC
87 MB