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