ソースコード
SELECT SURVEY_YEAR AS SV_YEAR, PF_NAME AS PREFECTURE, KIND, ELEMENTARY + MIDDLE + HIGH + JUNIOR_CLG + COLLEGE + GRADUATE AS AMT FROM (
SELECT
    *, 
  CASE WHEN b.index_num = 1 THEN '小学生'
       WHEN b.index_num = 2 THEN '中学校'
       WHEN b.index_num = 3 THEN '高校'
       WHEN b.index_num = 4 THEN '短大'
       WHEN b.index_num = 5 THEN '大学'
       WHEN b.index_num = 6 THEN '大学院' END AS KIND
FROM
  ENROLLMENT_STATUS AS e 
CROSS JOIN
  (
    SELECT 1 AS index_num UNION ALL
    SELECT 2 AS index_num UNION ALL
    SELECT 3 AS index_num UNION ALL 
    SELECT 4 AS index_num UNION ALL 
    SELECT 5 AS index_num UNION ALL 
    SELECT 6 AS index_num
  ) AS b
  ) JOIN PREFECTURE USING(PF_CODE)
  WHERE (KIND = '小学生' and ELEMENTARY > 0) ||
  (KIND = '中学生' and MIDDLE > 0) ||
  (KIND = '高校' and HIGH > 0) ||
  (KIND = '短大' and JUNIOR_CLG > 0) ||
  (KIND = '大学' and COLLEGE > 0) ||
  (KIND = '大学院' and GRADUATE > 0)
 ORDER BY PF_CODE DESC 
提出情報
提出日時2022/09/21 22:39:50
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者kumackey
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量104 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
101 MB
データパターン2
WA
104 MB