ソースコード
SELECT
    E.SURVEY_YEAR AS SV_YEAR,
    PF.PF_NAME AS PREFECTURE,
    KIND,
    SUM(Students) AS AMT
FROM (
    SELECT SURVEY_YEAR, PF_CODE, '小学校' AS KIND, ELEMENTARY AS Students FROM ENROLLMENT_STATUS WHERE SURVEY_YEAR = 2020
    UNION ALL
    SELECT SURVEY_YEAR, PF_CODE, '中学校' AS KIND, MIDDLE AS Students FROM ENROLLMENT_STATUS WHERE SURVEY_YEAR = 2020
    UNION ALL
    SELECT SURVEY_YEAR, PF_CODE, '高校' AS KIND, HIGH AS Students FROM ENROLLMENT_STATUS WHERE SURVEY_YEAR = 2020
    UNION ALL
    SELECT SURVEY_YEAR, PF_CODE, '短大' AS KIND, JUNIOR_CLG AS Students FROM ENROLLMENT_STATUS WHERE SURVEY_YEAR = 2020
    UNION ALL
    SELECT SURVEY_YEAR, PF_CODE, '大学' AS KIND, COLLEGE AS Students FROM ENROLLMENT_STATUS WHERE SURVEY_YEAR = 2020
    UNION ALL
    SELECT SURVEY_YEAR, PF_CODE, '大学院' AS KIND, GRADUATE AS Students FROM ENROLLMENT_STATUS WHERE SURVEY_YEAR = 2020
) E
LEFT JOIN PREFECTURE PF ON E.PF_CODE = PF.PF_CODE
GROUP BY E.SURVEY_YEAR, PF.PF_NAME, KIND
ORDER BY E.PF_CODE,KIND
提出情報
提出日時2024/01/22 09:07:29
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者doro
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量87 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
87 MB
データパターン2
WA
84 MB