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