ソースコード
with all_num as(
select PF_CODE, sum(AMT) as total_num from DRINK_HABITS
--where CATEGORY_CODE = '110'
--    and GENDER_CODE != '1'
group by PF_CODE
), drink as(
select PF_CODE, sum(AMT) as drink_num from DRINK_HABITS
where GENDER_CODE in ('2', '3')
    and CATEGORY_CODE = '120'
group by PF_CODE
)
select p.PF_CODE as CODE, p.PF_NAME as NAME, round(cast(k.drink_num as REAL) / cast(a.total_num as REAL) * 100,1) as PERCENTAGE from PREFECTURE p
left join all_num a on p.PF_CODE = a.PF_CODE
left join drink k on p.PF_CODE = k.PF_CODE
order by PERCENTAGE desc, CODE desc
;
提出情報
提出日時2022/09/22 00:17:10
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者birt
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量96 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
90 MB
データパターン2
WA
96 MB