コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
SELECT
SURVEY_YEAR as 'SV_YEAR',
PF_NAME as 'PREFECTURE',
'小学校' as 'KIND',
ELEMENTARY as 'AMT'
FROM
(SELECT
SURVEY_YEAR,
PF_NAME,
SUM(ELEMENTARY) AS 'ELEMENTARY'
FROM
ENROLLMENT_STATUS ES
LEFT JOIN
PREFECTURE PRF
ON ES.PF_CODE = PRF.PF_CODE
WHERE
SURVEY_YEAR = 2020
GROUP BY
SURVEY_YEAR,
PF_NAME
) BASE
WHERE AMT is not null
UNION ALL
SELECT
SURVEY_YEAR as 'SV_YEAR',
PF_NAME as 'PREFECTURE',
'中学校' as 'KIND',
MIDDLE as 'AMT'
FROM
(SELECT
SURVEY_YEAR,
PF_NAME,
SUM(MIDDLE) AS 'MIDDLE'
FROM
ENROLLMENT_STATUS ES
LEFT JOIN
PREFECTURE PRF
ON ES.PF_CODE = PRF.PF_CODE
WHERE
SURVEY_YEAR = 2020
GROUP BY
SURVEY_YEAR,
PF_NAME
) BASE
WHERE AMT is not null
UNION ALL
SELECT
SURVEY_YEAR as 'SV_YEAR',
PF_NAME as 'PREFECTURE',
'高校' as 'KIND',
HIGH as 'AMT'
FROM
(SELECT
SURVEY_YEAR,
PF_NAME,
SUM(HIGH) as 'HIGH'
FROM
ENROLLMENT_STATUS ES
LEFT JOIN
PREFECTURE PRF
ON ES.PF_CODE = PRF.PF_CODE
WHERE
SURVEY_YEAR = 2020
GROUP BY
SURVEY_YEAR,
PF_NAME
) BASE
WHERE AMT is not null
UNION ALL
SELECT
SURVEY_YEAR as 'SV_YEAR',
PF_NAME as 'PREFECTURE',
'短大' as 'KIND',
JUNIOR_CLG as 'AMT'
FROM
(SELECT
SURVEY_YEAR,
PF_NAME,
SUM(JUNIOR_CLG) as 'JUNIOR_CLG'
FROM
ENROLLMENT_STATUS ES
LEFT JOIN
PREFECTURE PRF
ON ES.PF_CODE = PRF.PF_CODE
WHERE
SURVEY_YEAR = 2020
GROUP BY
SURVEY_YEAR,
PF_NAME
) BASE
WHERE AMT is not null
UNION ALL
SELECT
SURVEY_YEAR as 'SV_YEAR',
PF_NAME as 'PREFECTURE',
'大学' as 'KIND',
COLLEGE as 'AMT'
FROM
(SELECT
SURVEY_YEAR,
PF_NAME,
SUM(COLLEGE) as 'COLLEGE'
FROM
ENROLLMENT_STATUS ES
LEFT JOIN
PREFECTURE PRF
ON ES.PF_CODE = PRF.PF_CODE
WHERE
SURVEY_YEAR = 2020
GROUP BY
SURVEY_YEAR,
PF_NAME
) BASE
WHERE AMT is not null
UNION ALL
SELECT
SURVEY_YEAR as 'SV_YEAR',
PF_NAME as 'PREFECTURE',
'大学院' as 'KIND',
GRADUATE as 'AMT'
FROM
(SELECT
SURVEY_YEAR,
PF_NAME,
SUM(GRADUATE) as 'GRADUATE'
FROM
ENROLLMENT_STATUS ES
LEFT JOIN
PREFECTURE PRF
ON ES.PF_CODE = PRF.PF_CODE
WHERE
SURVEY_YEAR = 2020
GROUP BY
SURVEY_YEAR,
PF_NAME
) BASE
WHERE AMT is not null
order by PREFECTURE
提出情報
提出日時 | 2023/12/07 11:40:37 |
コンテスト | 第2回 SQLコンテスト |
問題 | 就学状況の表示変換 |
受験者 | mimimi |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 87 MB |
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
87 MB
データパターン2
AC
84 MB