ソースコード
select A.PF_CODE as CODE, PF_NAME as NAME, round( cast(s as real) / cast(sum(AMT) as real) * 100, 1) as PERCENTAGE
from DRINK_HABITS as A

inner join (
select PF_CODE, sum(AMT) as s
from DRINK_HABITS
where (GENDER_CODE = 2 or GENDER_CODE = 3 ) and CATEGORY_CODE = 120
group by PF_CODE
) as B on B.PF_CODE = A.PF_CODE

inner join PREFECTURE on A.PF_CODE = PREFECTURE.PF_CODE

where (GENDER_CODE = 2 or GENDER_CODE = 3) and CATEGORY_CODE = 110
group by A.PF_CODE
order by PERCENTAGE desc, A.PF_CODE desc;
提出情報
提出日時2022/09/21 19:29:29
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者ayato
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量105 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
105 MB
データパターン2
AC
105 MB