ソースコード
select A.survey_year as SV_YEAR , B.pf_name as PREFECTURE , A. kind as KIND , sum (A.amt) as AMT
from (
    select 
        survey_year  , pf_code ,age , 1 as seq , '小学校' as KIND , ELEMENTARY as AMT from ENROLLMENT_STATUS 
        where ifnull(ELEMENTARY ,0) != 0
    union 
    select survey_year , pf_code , age, 2 , '中学校' , MIDDLE from ENROLLMENT_STATUS
        where ifnull(MIDDLE ,0) != 0
    union 
    select survey_year , pf_code , age, 3 , '高校' , HIGH from ENROLLMENT_STATUS
        where ifnull(HIGH ,0) != 0
    union
    select survey_year , pf_code , age, 4 , '短大' , JUNIOR_CLG from ENROLLMENT_STATUS
        where ifnull(JUNIOR_CLG ,0) != 0
    union
    select survey_year , pf_code , age, 5 , '大学' , COLLEGE from ENROLLMENT_STATUS
        where ifnull(COLLEGE ,0) != 0
    union
    select survey_year , pf_code , age, 6 , '大学院' , GRADUATE from ENROLLMENT_STATUS
        where ifnull(GRADUATE ,0) != 0    
) as A
inner join PREFECTURE as B on  A.pf_code = B.pf_code
where survey_year = 2020 and AMT is not null
group by survey_year , A.pf_code , seq
order by A.pf_code , seq 
提出情報
提出日時2023/10/27 11:26:52
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者hmasa
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量77 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
77 MB
データパターン2
AC
76 MB