コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
with base as (
SELECT
SURVEY_YEAR AS SV_YEAR,
PF_CODE AS PREFECTURE,
MAX(IIF(ELEMENTARY > 0 ,'小学校','')) AS KIND,
MAX(IIF(ELEMENTARY > 0 ,'a','')) AS ord,
SUM(ELEMENTARY) AS AMT
FROM
ENROLLMENT_STATUS
WHERE
SURVEY_YEAR = 2020
GROUP BY
PF_CODE
union
SELECT
SURVEY_YEAR AS SV_YEAR,
PF_CODE AS PREFECTURE,
MAX(IIF(MIDDLE > 0 ,'中学校','')) AS KIND,
MAX(IIF(MIDDLE > 0 ,'b','')) AS ord,
SUM(MIDDLE) AS AMT
FROM
ENROLLMENT_STATUS
WHERE
SURVEY_YEAR = 2020
GROUP BY
PF_CODE
union
SELECT
SURVEY_YEAR AS SV_YEAR,
PF_CODE AS PREFECTURE,
MAX(IIF(HIGH > 0 ,'高校','')) AS KIND,
MAX(IIF(HIGH > 0 ,'c','')) AS ord,
SUM(HIGH) AS AMT
FROM
ENROLLMENT_STATUS
WHERE
SURVEY_YEAR = 2020
GROUP BY
PF_CODE
union
SELECT
SURVEY_YEAR AS SV_YEAR,
PF_CODE AS PREFECTURE,
MAX(IIF(JUNIOR_CLG > 0 ,'短大','')) AS KIND,
MAX(IIF(JUNIOR_CLG > 0 ,'d','')) AS ord,
SUM(JUNIOR_CLG) AS AMT
FROM
ENROLLMENT_STATUS
WHERE
SURVEY_YEAR = 2020
GROUP BY
PF_CODE
union
SELECT
SURVEY_YEAR AS SV_YEAR,
PF_CODE AS PREFECTURE,
MAX(IIF(COLLEGE > 0 ,'大学','')) AS KIND,
MAX(IIF(COLLEGE > 0 ,'e','')) AS ord,
SUM(COLLEGE) AS AMT
FROM
ENROLLMENT_STATUS
WHERE
SURVEY_YEAR = 2020
GROUP BY
PF_CODE
union
SELECT
SURVEY_YEAR AS SV_YEAR,
PF_CODE AS PREFECTURE,
MAX(IIF(GRADUATE > 0 ,'大学院','')) AS KIND,
MAX(IIF(GRADUATE > 0 ,'f','')) AS ord,
SUM(GRADUATE) AS AMT
FROM
ENROLLMENT_STATUS
WHERE
SURVEY_YEAR = 2020
GROUP BY
PF_CODE
order by PREFECTURE ASC, ord ASC
)
select
SV_YEAR,
PREFECTURE,
KIND,
AMT
from
base
WHERE
AMT > 0
提出情報
提出日時 | 2023/12/12 18:16:36 |
コンテスト | 第2回 SQLコンテスト |
問題 | 就学状況の表示変換 |
受験者 | yamamtmg |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 87 MB |
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
87 MB
データパターン2
WA
85 MB