ソースコード
select es.SURVEY_YEAR as SV_YEAR
       , p.PF_NAME as PREFECTURE
       , es.kind as KIND
       , es.kinde as AMT
from( select survey_year
             , pf_code
             , '小学校' as kind
             , sum(ELEMENTARY) as kinde
             , 1 as a
        from ENROLLMENT_STATUS
        where survey_year = '2020'
        group by survey_year
             , pf_code
             , kind
             , a
        union all
      select survey_year
             , pf_code
             , '中学校' as kind
             , sum(MIDDLE) as kinde
             , 2 as a
        from ENROLLMENT_STATUS
        where survey_year = '2020'
        group by survey_year
             , pf_code
             , kind
             , a
        union all
      select survey_year
             , pf_code
             , '高校' as kind
             , sum(HIGH) as kinde
             , 3 as a
        from ENROLLMENT_STATUS
        where survey_year = '2020'
        group by survey_year
             , pf_code
             , kind
             , a
        union all
      select survey_year
             , pf_code
             , '短大' as kind
             , sum(JUNIOR_CLG) as kinde
             , 4 as a
        from ENROLLMENT_STATUS
        where survey_year = '2020'
        group by survey_year
             , pf_code
             , kind
             , a
        union all
      select survey_year
             , pf_code
             , '大学' as kind
             , sum(COLLEGE) as kinde
             , 5 as a
        from ENROLLMENT_STATUS
        where survey_year = '2020'
        group by survey_year
             , pf_code
             , kind
             , a
        union all
      select survey_year
             , pf_code
             , '大学院' as kind
             , sum(GRADUATE) as kinde
             , 6 as a
        from ENROLLMENT_STATUS
        where survey_year = '2020'
        group by survey_year
             , pf_code
             , kind
             , a) as es
        join PREFECTURE as p
        on p.pf_code = es.pf_code
        where AMT is not null
       order by es.pf_code, es.a;
提出情報
提出日時2022/09/22 17:26:30
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者roundoneknockout
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量82 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
82 MB
データパターン2
AC
80 MB