コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
WITH Pre AS(
SELECT
E.SURVEY_YEAR AS SV_YEAR,
E.PF_CODE,
P.PF_NAME AS PREFECTURE,
SUM(ELEMENTARY) AS ELEMENTARY,
SUM(MIDDLE) AS MIDDLE,
SUM(HIGH) AS HIGH,
SUM(JUNIOR_CLG) AS JUNIOR_CLG,
SUM(COLLEGE) AS COLLEGE,
SUM(GRADUATE) AS GRADUATE
FROM
ENROLLMENT_STATUS AS E
INNER JOIN
PREFECTURE AS P
ON
E.PF_CODE = P.PF_CODE
WHERE
SURVEY_YEAR = 2020
GROUP BY
E.PF_CODE
),
Pre2 AS (
SELECT
PF_CODE,
SV_YEAR,
PREFECTURE,
'小学校' AS KIND,
ELEMENTARY AS AMT
FROM
Pre
WHERE
AMT IS NOT NULL
UNION ALL
SELECT
PF_CODE,
SV_YEAR,
PREFECTURE,
'中学校' AS KIND,
MIDDLE AS AMT
FROM
Pre
WHERE
AMT IS NOT NULL
UNION ALL
SELECT
PF_CODE,
SV_YEAR,
PREFECTURE,
'高校' AS KIND,
HIGH AS AMT
FROM
Pre
WHERE
AMT IS NOT NULL
UNION ALL
SELECT
PF_CODE,
SV_YEAR,
PREFECTURE,
'短大' AS KIND,
JUNIOR_CLG AS AMT
FROM
Pre
WHERE
AMT IS NOT NULL
UNION ALL
SELECT
PF_CODE,
SV_YEAR,
PREFECTURE,
'大学' AS KIND,
COLLEGE AS AMT
FROM
Pre
WHERE
AMT IS NOT NULL
UNION ALL
SELECT
PF_CODE,
SV_YEAR,
PREFECTURE,
'大学院' AS KIND,
GRADUATE AS AMT
FROM
Pre
WHERE
AMT IS NOT NULL
)
SELECT
SV_YEAR,
PREFECTURE,
KIND,
AMT
FROM
Pre2
ORDER BY
PF_CODE
提出情報
提出日時 | 2023/11/03 18:13:02 |
コンテスト | 第2回 SQLコンテスト |
問題 | 就学状況の表示変換 |
受験者 | north_mb_p |
状態 (詳細) | AC (Accepted: 正答) |
メモリ使用量 | 76 MB |
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
76 MB
データパターン2
AC
74 MB