ソースコード
SELECT
2020 SV_YEAR,
PF.PF_NAME PREFECTURE,
ES.KIND KIND,
SUM(ES.AMT) AMT

FROM
PREFECTURE PF

JOIN (
SELECT SURVEY_YEAR, PF_CODE, 1 OD, '小学校' KIND, ELEMENTARY AMT
FROM ENROLLMENT_STATUS
WHERE SURVEY_YEAR = 2020

UNION

SELECT SURVEY_YEAR, PF_CODE, 2 OD, '中学校' KIND, MIDDLE AMT
FROM ENROLLMENT_STATUS
WHERE SURVEY_YEAR = 2020

UNION

SELECT SURVEY_YEAR, PF_CODE, 3 OD, '高校' KIND, HIGH AMT
FROM ENROLLMENT_STATUS
WHERE SURVEY_YEAR = 2020

UNION

SELECT SURVEY_YEAR, PF_CODE, 4 OD, '短大' KIND, JUNIOR_CLG AMT
FROM ENROLLMENT_STATUS
WHERE SURVEY_YEAR = 2020

UNION

SELECT SURVEY_YEAR, PF_CODE, 5 OD, '大学' KIND, COLLEGE AMT
FROM ENROLLMENT_STATUS
WHERE SURVEY_YEAR = 2020

UNION

SELECT SURVEY_YEAR, PF_CODE, 6 OD, '大学院' KIND, GRADUATE AMT
FROM ENROLLMENT_STATUS
WHERE SURVEY_YEAR = 2020
) ES
ON
PF.PF_CODE = ES.PF_CODE

GROUP BY
PF.PF_CODE,
ES.KIND

HAVING
SUM(ES.AMT) IS NOT NULL

ORDER BY
ES.SURVEY_YEAR,
ES.PF_CODE,
ES.OD
提出情報
提出日時2022/09/24 19:50:20
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者kkrz57C
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量78 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
78 MB
データパターン2
WA
75 MB