ソースコード
select 
SURVEY_YEAR as SV_YEAR,
PF_NAME as PREFECTURE,
case when
k=1 then '小学校'
when
k=2 then '中学校'
when
k=3 then '高校'
when
k=4 then '短大'
when
k=5 then '大学'
when
k=6 then '大学院'
end as KIND,
sum(amt) as AMT

from (
select SURVEY_YEAR,PF_CODE,AGE,1 as k,ELEMENTARY as amt from 
ENROLLMENT_STATUS   union 

select SURVEY_YEAR,PF_CODE,AGE, 2 as k,MIDDLE as amt from 
ENROLLMENT_STATUS 
union 
select SURVEY_YEAR,PF_CODE,AGE,3 as k,HIGH as amt from 
ENROLLMENT_STATUS
union
select SURVEY_YEAR,PF_CODE,AGE,4 as k,JUNIOR_CLG as amt from 
ENROLLMENT_STATUS  
union 
select SURVEY_YEAR,PF_CODE,AGE,5 as k,COLLEGE as amt from 
ENROLLMENT_STATUS 
union 
select SURVEY_YEAR,PF_CODE,AGE,6 as k,GRADUATE as amt from 
ENROLLMENT_STATUS
) as aa
inner join 
PREFECTURE p
on aa.pf_code = p.pf_code
where
aa.survey_year=2020
and amt>=0
group by 1,2,aa.pf_code,3
order by aa.pf_code,k
提出情報
提出日時2022/09/22 10:18:39
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者noneof383
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量99 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
99 MB
データパターン2
AC
97 MB