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