ソースコード
SELECT STAT.SURVEY_YEAR, PREF.PF_NAME,
    CASE STAT.NO
        WHEN 1 THEN '小学校'
        WHEN 2 THEN '中学校'
        WHEN 3 THEN '高校'
        WHEN 4 THEN '短大'
        WHEN 5 THEN '大学'
        WHEN 6 THEN '大学院'
    END KIND,
    STAT.AMT
FROM
    (
        SELECT SURVEY_YEAR, PF_CODE, 1 NO, SUM(ELEMENTARY) AMT FROM ENROLLMENT_STATUS GROUP BY SURVEY_YEAR, PF_CODE
        UNION ALL
        SELECT SURVEY_YEAR, PF_CODE, 2 NO, SUM(MIDDLE) AMT FROM ENROLLMENT_STATUS GROUP BY SURVEY_YEAR, PF_CODE
        UNION ALL
        SELECT SURVEY_YEAR, PF_CODE, 3 NO, SUM(HIGH) AMT FROM ENROLLMENT_STATUS GROUP BY SURVEY_YEAR, PF_CODE
        UNION ALL
        SELECT SURVEY_YEAR, PF_CODE, 4 NO, SUM(JUNIOR_CLG) AMT FROM ENROLLMENT_STATUS GROUP BY SURVEY_YEAR, PF_CODE
        UNION ALL
        SELECT SURVEY_YEAR, PF_CODE, 5 NO, SUM(COLLEGE) AMT FROM ENROLLMENT_STATUS GROUP BY SURVEY_YEAR, PF_CODE
        UNION ALL
        SELECT SURVEY_YEAR, PF_CODE, 6 NO, SUM(GRADUATE) AMT FROM ENROLLMENT_STATUS GROUP BY SURVEY_YEAR, PF_CODE
    ) STAT
    LEFT JOIN PREFECTURE PREF
        ON STAT.PF_CODE = PREF.PF_CODE
WHERE STAT.SURVEY_YEAR = '2020'
    AND STAT.AMT IS NOT NULL
ORDER BY STAT.PF_CODE, STAT.NO
提出情報
提出日時2022/09/22 16:45:44
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者mugi
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量79 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
79 MB
データパターン2
WA
75 MB