ソースコード
WITH enroll_un as (
SELECT SURVEY_YEAR, PF_CODE, AGE, '小学校' AS key, ELEMENTARY AS value, 1 as ord FROM ENROLLMENT_STATUS
UNION ALL
SELECT SURVEY_YEAR, PF_CODE,AGE,  '中学校' AS key, MIDDLE AS value ,2 as ord FROM ENROLLMENT_STATUS
UNION ALL
SELECT SURVEY_YEAR,PF_CODE,AGE,   '高校' AS key, HIGH AS value ,3 as ord FROM ENROLLMENT_STATUS
UNION ALL
SELECT SURVEY_YEAR,PF_CODE,AGE,   '短大' AS key, JUNIOR_CLG AS value ,4 as ord  FROM ENROLLMENT_STATUS
UNION ALL
SELECT SURVEY_YEAR,PF_CODE,AGE,   '大学' AS key, COLLEGE AS value ,5 as ord FROM ENROLLMENT_STATUS
UNION ALL
SELECT SURVEY_YEAR,PF_CODE,AGE,   '大学院' AS key, GRADUATE AS value  ,6 as ord FROM ENROLLMENT_STATUS
)
SELECT
    e.SURVEY_YEAR as SV_YEAR,
    p.PF_NAME as PREFECTURE,
    e.key as KIND,
    SUM(e.value)  as AMT
FROM
    enroll_un as e
JOIN
    PREFECTURE as p
ON
    e.PF_CODE = p.PF_CODE
GROUP BY
    1, 2, 3
ORDER BY 
    e.PF_CODE ASC,
    e.ord asc 
提出情報
提出日時2022/09/21 20:22:47
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者kyo_saikyo
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量97 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
97 MB
データパターン2
WA
95 MB