ソースコード
select d1.PF_CODE as CODE
     , p1.PF_NAME as NAME
     , round(cast(d2.AMT as REAL) / cast(d1.AMT as REAL) * 100, 1) as PERCENTAGE
  from (
        select PF_CODE, sum(AMT) as AMT
          from DRINK_HABITS
         where CATEGORY_CODE = '110'
           and GENDER_CODE in ('2','3')
        group by PF_CODE
       ) d1
       inner join (
        select PF_CODE, sum(AMT) as AMT
          from DRINK_HABITS
         where CATEGORY_CODE = '120'
           and GENDER_CODE in ('2','3')
        group by PF_CODE
       ) d2
         on d1.PF_CODE = d2.PF_CODE
       left outer join PREFECTURE as p1
         on d1.PF_CODE = p1.PF_CODE
order by round(cast(d2.AMT as REAL) / cast(d1.AMT as REAL) * 100, 1) desc
;
提出情報
提出日時2022/09/21 19:41:11
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者BRILLIANTOCEAN55
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量105 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
105 MB
データパターン2
AC
105 MB