ソースコード
select d.PF_CODE as CODE
,PF_NAME as NAME
,round((
select sum(cast(AMT as real)) from DRINK_HABITS
where (GENDER_CODE = '2' or GENDER_CODE = '3')
and (CATEGORY_CODE = '120')
and d.PF_CODE = PF_CODE
group by PF_CODE
)*100
/
(
select sum(cast(AMT as real)) from DRINK_HABITS
where (GENDER_CODE = '2' or GENDER_CODE = '3')
and (CATEGORY_CODE = '110')
and d.PF_CODE = PF_CODE
group by PF_CODE
),1)
as PERCENTAGE
from DRINK_HABITS d
join PREFECTURE p on (d.PF_CODE = p.PF_CODE)
group by d.PF_CODE
order by PERCENTAGE desc, CODE desc;
提出情報
提出日時2022/09/22 11:51:45
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者Chorinu
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量97 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
93 MB
データパターン2
AC
97 MB