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