ソースコード
select A.sv_year as SV_YEAR , B.pf_name as PREFECTURE , A. kind as KIND , sum (A.amt) as AMT

from (

    select 
        survey_year as sv_year , pf_code ,age , 1 as seq , '小学校' as KIND , ELEMENTARY as AMT from ENROLLMENT_STATUS 
        where survey_year = 2020 and ifnull(ELEMENTARY ,0) != 0
    union 
    select survey_year , pf_code , age, 2 , '中学校' , MIDDLE from ENROLLMENT_STATUS
        where survey_year = 2020 and ifnull(MIDDLE ,0) != 0
    union 
    select survey_year , pf_code , age, 3 , '高校' , HIGH from ENROLLMENT_STATUS
     where survey_year = 2020 and ifnull(HIGH ,0) != 0
    union
    select survey_year , pf_code , age, 4 , '短大' , JUNIOR_CLG from ENROLLMENT_STATUS
        where survey_year = 2020 and ifnull(JUNIOR_CLG ,0) != 0
    union
    select survey_year , pf_code , age, 5 , '大学' , COLLEGE from ENROLLMENT_STATUS
        where survey_year = 2020 and ifnull(COLLEGE ,0) != 0
    union
    select survey_year , pf_code , age, 6 , '大学院' , GRADUATE from ENROLLMENT_STATUS
        where survey_year = 2020 and ifnull(GRADUATE ,0) != 0    
) as A

inner join PREFECTURE as B on  A.pf_code = B.pf_code

group by sv_year , A.pf_code , seq
order by A.pf_code , seq 
提出情報
提出日時2023/10/27 11:19:39
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者hmasa
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量76 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
76 MB
データパターン2
AC
75 MB