コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
SELECT
t1.SURVEY_YEAR AS SV_YEAR
,t2.KIND_NAME AS KIND
,t1.SUM_COUNT AS AMT
FROM
(
SELECT
SURVEY_YEAR
,PF_CODE
,'ELEMENTARY' AS KIND_ID
,SUM(ELEMENTARY) AS SUM_COUNT
FROM
ENROLLMENT_STATUS
WHERE
SURVEY_YEAR = 2020
GROUP BY
PF_CODE
UNION
SELECT
SURVEY_YEAR
,PF_CODE
,'MIDDLE' AS KIND_ID
,SUM(MIDDLE) SUM_COUNT
FROM
ENROLLMENT_STATUS
WHERE
SURVEY_YEAR = 2020
GROUP BY
PF_CODE
UNION
SELECT
SURVEY_YEAR
,PF_CODE
,'HIGH' AS KIND_ID
,SUM(HIGH) SUM_COUNT
FROM
ENROLLMENT_STATUS
WHERE
SURVEY_YEAR = 2020
GROUP BY
PF_CODE
UNION
SELECT
SURVEY_YEAR
,PF_CODE
,'JUNIOR_CLG' AS KIND_ID
,SUM(JUNIOR_CLG) SUM_COUNT
FROM
ENROLLMENT_STATUS
WHERE
SURVEY_YEAR = 2020
GROUP BY
PF_CODE
UNION
SELECT
SURVEY_YEAR
,PF_CODE
,'COLLEGE' AS KIND_ID
,SUM(COLLEGE) SUM_COUNT
FROM
ENROLLMENT_STATUS
WHERE
SURVEY_YEAR = 2020
GROUP BY
PF_CODE
UNION
SELECT
SURVEY_YEAR
,PF_CODE
,'GRADUATE' AS KIND_ID
,SUM(GRADUATE) SUM_COUNT
FROM
ENROLLMENT_STATUS
WHERE
SURVEY_YEAR = 2020
GROUP BY
PF_CODE
) AS t1
,(
SELECT 'ELEMENTARY' AS KIND_ID, '小学校' AS KIND_NAME, 1 AS SHOW_SEQ
UNION ALL SELECT 'MIDDLE' AS KIND_ID, '中学校' AS KIND_NAME, 2 AS SHOW_SEQ
UNION ALL SELECT 'HIGH' AS KIND_ID, '高校' AS KIND_NAME, 3 AS SHOW_SEQ
UNION ALL SELECT 'JUNIOR_CLG' AS KIND_ID, '短大' AS KIND_NAME, 4 AS SHOW_SEQ
UNION ALL SELECT 'COLLEGE' AS KIND_ID, '大学' AS KIND_NAME, 5 AS SHOW_SEQ
UNION ALL SELECT 'GRADUATE' AS KIND_ID, '大学院' AS KIND_NAME, 6 AS SHOW_SEQ
) AS t2
WHERE
t1.KIND_ID = t2.KIND_ID
AND t1.SUM_COUNT IS NOT NULL
ORDER BY
t1.PF_CODE ASC
,t2.SHOW_SEQ ASC
提出情報
提出日時 | 2022/09/22 08:31:58 |
コンテスト | 第2回 SQLコンテスト |
問題 | 就学状況の表示変換 |
受験者 | nezumi |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 94 MB |
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
94 MB
データパターン2
WA
89 MB