ソースコード
select 
  su.SURVEY_YEAR as SV_YEAR
  ,PR.PF_NAME as PREFECTURE
  ,case 
    when seq = 1 then '小学校'
    when seq = 2 then '中学校'
    when seq = 3 then '高校'
    when seq = 4 then '短大'
    when seq = 5 then '大学'
    when seq = 6 then '大学院'
   end as KIND
  ,case
    when seq = 1 then s1
    when seq = 2 then s2
    when seq = 3 then s3
    when seq = 4 then s4
    when seq = 5 then s5
    when seq = 6 then s6
   end as AMT
from 
(select 1 as seq union
select 2 as seq union
select 3 as seq union
select 4 as seq union
select 5 as seq union
select 6 as seq 
) cross join
(
select 
  SURVEY_YEAR
  ,PF_CODE
  ,sum(ELEMENTARY) as 's1'
  ,sum(MIDDLE) as 's2'
  ,sum(HIGH) as 's3'
  ,sum(JUNIOR_CLG) as 's4'
  ,sum(COLLEGE) as 's5'
  ,sum(GRADUATE) as 's6'
from 
  ENROLLMENT_STATUS
where 
  SURVEY_YEAR = 2020
group by 
  PF_CODE
) su
  left join PREFECTURE PR
    on pr.PF_CODE = su.PF_CODE
where 
  AMT > 0
order by 
    su.PF_CODE asc
    ,seq asc
;
提出情報
提出日時2022/09/22 11:54:23
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者idakazoo
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量97 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
97 MB
データパターン2
AC
96 MB