ソースコード
with org as (
select * from ENROLLMENT_STATUS
where SURVEY_YEAR = 2020
    -- and PF_CODE = '36000'
-- order by age
), org2 as (
select
    pf_code
    , '小学校' as kind
    , 1 as rank
    , sum(ELEMENTARY) as amt
from org
group by PF_CODE
union all
select
    pf_code
    , '中学校' as kind
    , 2 as rank
    , sum(MIDDLE) as amt
from org
group by PF_CODE
union all
select
    pf_code
    , '高学校' as kind
    , 3 as rank
    , sum(HIGH) as amt
from org
group by PF_CODE
union all
select
    pf_code
    , '短大' as kind
    , 4 as rank
    , sum(JUNIOR_CLG) as amt
from org
group by PF_CODE
union all
select
    pf_code
    , '大学' as kind
    , 5 as rank
    , sum(COLLEGE) as amt
from org
group by PF_CODE
union all
select
    pf_code
    , '大学院' as kind
    , 6 as rank
    , sum(GRADUATE) as amt
from org
group by PF_CODE
)
select
    '2020' as SV_YEAR
    , b.pf_name as PREFECTURE
    , a.kind as KIND
    , a.amt as AMT
from org2 a
inner join prefecture b
    on a.pf_code = b.pf_code
where a.amt is not null
order by a.pf_code, a.rank
;
提出情報
提出日時2023/03/13 23:28:06
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者s4wara_o
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量81 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
81 MB
データパターン2
WA
77 MB