ソースコード
with A as (
select SURVEY_YEAR, PF_CODE, ELEMENTARY as AMT, '小学校' as KIND, 1 as num from ENROLLMENT_STATUS
union all
select SURVEY_YEAR, PF_CODE, MIDDLE as AMT, '中学校' as KIND, 2 as num from ENROLLMENT_STATUS
union all
select SURVEY_YEAR, PF_CODE, HIGH as AMT, '高校' as KIND, 3 as num from ENROLLMENT_STATUS
union all
select SURVEY_YEAR, PF_CODE, JUNIOR_CLG as AMT, '短大' as KIND, 4 as num from ENROLLMENT_STATUS
union all
select SURVEY_YEAR, PF_CODE, COLLEGE as AMT, '大学' as KIND, 5 as num from ENROLLMENT_STATUS
union all
select SURVEY_YEAR, PF_CODE, GRADUATE as AMT, '大学院' as KIND, 6 as num from ENROLLMENT_STATUS
)
select
    A.SURVEY_YEAR as SV_YEAR,
    P.PF_NAME,
    A.KIND,
    sum(A.AMT) as AMT
from
    A
    inner join
    PREFECTURE P
    on A.PF_CODE=P.PF_CODE
where
    A.SURVEY_YEAR='2020'
group by
    A.SURVEY_YEAR,
    P.PF_NAME,
    A.KIND
having
    sum(A.AMT) is not null
order by
    P.PF_CODE,
    A.num
提出情報
提出日時2022/09/22 09:20:03
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者hamanonz
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量95 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
95 MB
データパターン2
WA
84 MB