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