ソースコード
select 
    2020 SV_YEAR, 
    (select PF_NAME FROM Prefecture p where p.PF_CODE=u.PF_CODE) PREFECTURE,
    KIND,
    sum(AMOUT) AMT
from (
    select SURVEY_YEAR, PF_CODE, '小学校' KIND, 1 KIND_NUM, ELEMENTARY AMOUT from ENROLLMENT_STATUS where SURVEY_YEAR = 2020
    union
    select SURVEY_YEAR, PF_CODE, '中学校' KIND, 2 KIND_NUM, MIDDLE AMOUT from ENROLLMENT_STATUS where SURVEY_YEAR = 2020
    union
    select SURVEY_YEAR, PF_CODE, '高校' KIND, 3 KIND_NUM, HIGH AMOUT from ENROLLMENT_STATUS where SURVEY_YEAR = 2020
    union
    select SURVEY_YEAR, PF_CODE, '短大' KIND, 4 KIND_NUM, JUNIOR_CLG AMOUT from ENROLLMENT_STATUS where SURVEY_YEAR = 2020
    union
    select SURVEY_YEAR, PF_CODE, '大学院' KIND, 5 KIND_NUM, GRADUATE AMOUT from ENROLLMENT_STATUS where SURVEY_YEAR = 2020
) u
group by PF_CODE, KIND, KIND_NUM
having AMT IS NOT NULL
order by PF_CODE, KIND_NUM 
提出情報
提出日時2022/09/21 21:26:23
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者jau5
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量81 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
81 MB
データパターン2
WA
79 MB