ソースコード
SELECT 
    ES.SURVEY_YEAR AS SV_YEAR,
    P.PF_NAME AS PREFECTURE,
    '小学校' AS KIND,
    ES.ELEMENTARY AS AMT
FROM 
    ENROLLMENT_STATUS ES
JOIN 
    PREFECTURE P ON ES.PF_CODE = P.PF_CODE
WHERE 
    ES.SURVEY_YEAR = 2020 AND ES.ELEMENTARY IS NOT NULL

UNION

SELECT 
    ES.SURVEY_YEAR AS SV_YEAR,
    P.PF_NAME AS PREFECTURE,
    '中学校' AS KIND,
    ES.MIDDLE AS AMT
FROM 
    ENROLLMENT_STATUS ES
JOIN 
    PREFECTURE P ON ES.PF_CODE = P.PF_CODE
WHERE 
    ES.SURVEY_YEAR = 2020 AND ES.MIDDLE IS NOT NULL

UNION

SELECT 
    ES.SURVEY_YEAR AS SV_YEAR,
    P.PF_NAME AS PREFECTURE,
    '高等学校' AS KIND,
    ES.HIGH AS AMT
FROM 
    ENROLLMENT_STATUS ES
JOIN 
    PREFECTURE P ON ES.PF_CODE = P.PF_CODE
WHERE 
    ES.SURVEY_YEAR = 2020 AND ES.HIGH IS NOT NULL

UNION

SELECT 
    ES.SURVEY_YEAR AS SV_YEAR,
    P.PF_NAME AS PREFECTURE,
    '短大' AS KIND,
    ES.JUNIOR_CLG AS AMT
FROM 
    ENROLLMENT_STATUS ES
JOIN 
    PREFECTURE P ON ES.PF_CODE = P.PF_CODE
WHERE 
    ES.SURVEY_YEAR = 2020 AND ES.JUNIOR_CLG IS NOT NULL

UNION

SELECT 
    ES.SURVEY_YEAR AS SV_YEAR,
    P.PF_NAME AS PREFECTURE,
    '大学' AS KIND,
    ES.COLLEGE AS AMT
FROM 
    ENROLLMENT_STATUS ES
JOIN 
    PREFECTURE P ON ES.PF_CODE = P.PF_CODE
WHERE 
    ES.SURVEY_YEAR = 2020 AND ES.COLLEGE IS NOT NULL

UNION

SELECT 
    ES.SURVEY_YEAR AS SV_YEAR,
    P.PF_NAME AS PREFECTURE,
    '大学院' AS KIND,
    ES.GRADUATE AS AMT
FROM 
    ENROLLMENT_STATUS ES
JOIN 
    PREFECTURE P ON ES.PF_CODE = P.PF_CODE
WHERE 
    ES.SURVEY_YEAR = 2020 AND ES.GRADUATE IS NOT NULL

ORDER BY 
    PREFECTURE ASC, 
    KIND ASC;
提出情報
提出日時2023/07/25 21:33:01
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者tachiba87
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量81 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
80 MB
データパターン2
WA
81 MB