ソースコード
SELECT SURVEY_YEAR AS SV_YEAR
       ,PF_NAME AS PREFECTURE
       ,KIND AS KIND
       ,SUM(AMT) AS AMT
  FROM (SELECT PF_CODE 
        ,ELEMENTARY AS AMT
        ,'ELEMENTARY'AS KIND
        ,SURVEY_YEAR
        ,1 AS CODE
   FROM ENROLLMENT_STATUS
  WHERE SURVEY_YEAR = 2020
UNION ALL
 SELECT PF_CODE 
        ,MIDDLE AS AMT
        ,'MIDDLE'AS KIND
        ,SURVEY_YEAR
        ,2 AS CODE
   FROM ENROLLMENT_STATUS
  WHERE SURVEY_YEAR = 2020
UNION ALL  
 SELECT PF_CODE 
        ,HIGH AS AMT
        ,'HIGH'AS KIND
        ,SURVEY_YEAR
        ,3 AS CODE
   FROM ENROLLMENT_STATUS
  WHERE SURVEY_YEAR = 2020
UNION ALL  
  SELECT PF_CODE 
        ,JUNIOR_CLG AS AMT
        ,'JUNIOR_CLG'AS KIND
        ,SURVEY_YEAR
        ,4 AS CODE
   FROM ENROLLMENT_STATUS
  WHERE SURVEY_YEAR = 2020
UNION ALL  
  SELECT PF_CODE 
        ,COLLEGE AS AMT
        ,'COLLEGE'AS KIND
        ,SURVEY_YEAR
        ,5 AS CODE
   FROM ENROLLMENT_STATUS
  WHERE SURVEY_YEAR = 2020
UNION ALL  
  SELECT PF_CODE 
        ,GRADUATE AS AMT
        ,'GRADUATE'AS KIND
        ,SURVEY_YEAR
        ,6 AS CODE
   FROM ENROLLMENT_STATUS
  WHERE SURVEY_YEAR = 2020) ENROLLMENT_STATUS
  JOIN PREFECTURE
    ON ENROLLMENT_STATUS.PF_CODE = PREFECTURE.PF_CODE
 GROUP BY ENROLLMENT_STATUS.PF_CODE,KIND
 ORDER BY ENROLLMENT_STATUS.PF_CODE DESC,CODE
提出情報
提出日時2022/09/21 17:46:24
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者neene
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量95 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
95 MB
データパターン2
WA
84 MB