ソースコード
SELECT
 T.SURVEY_YEAR AS SV_YEAR
,P.PF_NAME AS PREFECTURE
,T.KIND
,T.AMT
FROM (
SELECT SURVEY_YEAR, PF_CODE, "小学校" AS KIND, 1 AS KO, SUM(ELEMENTARY) AS AMT FROM ENROLLMENT_STATUS WHERE ELEMENTARY IS NOT NULL UNION
SELECT SURVEY_YEAR, PF_CODE, "中学校" AS KIND, 2 AS KO, SUM(MIDDLE)     AS AMT FROM ENROLLMENT_STATUS WHERE MIDDLE IS NOT NULL UNION
SELECT SURVEY_YEAR, PF_CODE, "高校"   AS KIND, 3 AS KO, SUM(HIGH)       AS AMT FROM ENROLLMENT_STATUS WHERE HIGH IS NOT NULL UNION
SELECT SURVEY_YEAR, PF_CODE, "短大"   AS KIND, 4 AS KO, SUM(JUNIOR_CLG) AS AMT FROM ENROLLMENT_STATUS WHERE JUNIOR_CLG IS NOT NULL UNION
SELECT SURVEY_YEAR, PF_CODE, "大学"   AS KIND, 5 AS KO, SUM(COLLEGE)    AS AMT FROM ENROLLMENT_STATUS WHERE COLLEGE IS NOT NULL UNION
SELECT SURVEY_YEAR, PF_CODE, "大学院" AS KIND, 6 AS KO, SUM(GRADUATE)   AS AMT FROM ENROLLMENT_STATUS WHERE GRADUATE IS NOT NULL 
) AS T
INNER JOIN PREFECTURE AS P
ON T.PF_CODE = P.PF_CODE
ORDER BY
T.PF_CODE
,T.KO
提出情報
提出日時2022/09/21 18:29:13
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者aaaaabbbbbbbee
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量100 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
100 MB
データパターン2
WA
96 MB