コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
with uniontable
as (
SELECT
e.survey_year as SV_YEAR
,p.pf_code
,p.pf_name as PREFECTURE
,'小学校'as KIND
,sum(e.elementary) as AMT
FROM enrollment_status e
Inner join prefecture p
on p.pf_code = e.pf_code
where
survey_year = 2020
group by
e.survey_year,p.pf_name
union all
SELECT
e.survey_year as SV_YEAR
,p.pf_code
,p.pf_name as PREFECTURE
,'中学校'as KIND
,sum(e.middle) as AMT
FROM enrollment_status e
Inner join prefecture p
on p.pf_code = e.pf_code
where
survey_year = 2020
group by
e.survey_year,p.pf_name
union all
SELECT
e.survey_year as SV_YEAR
,p.pf_code
,p.pf_name as PREFECTURE
,'高校'as KIND
,sum(e.high) as AMT
FROM enrollment_status e
Inner join prefecture p
on p.pf_code = e.pf_code
where
survey_year = 2020
group by
e.survey_year,p.pf_name
union all
SELECT
e.survey_year as SV_YEAR
,p.pf_code
,p.pf_name as PREFECTURE
,'短大'as KIND
,sum(e.junior_clg) as AMT
FROM enrollment_status e
Inner join prefecture p
on p.pf_code = e.pf_code
where
survey_year = 2020
group by
e.survey_year,p.pf_name
union all
SELECT
e.survey_year as SV_YEAR
,p.pf_code
,p.pf_name as PREFECTURE
,'大学'as KIND
,sum(e.college) as AMT
FROM enrollment_status e
Inner join prefecture p
on p.pf_code = e.pf_code
where
survey_year = 2020
group by
e.survey_year,p.pf_name
union all
SELECT
e.survey_year as SV_YEAR
,p.pf_code
,p.pf_name as PREFECTURE
,'大学院'as KIND
,sum(e.graduate) as AMT
FROM enrollment_status e
Inner join prefecture p
on p.pf_code = e.pf_code
where
survey_year = 2020
group by
e.survey_year,p.pf_name
)
select
*
from uniontable
where amt is not null
order by
pf_code asc
提出情報
提出日時 | 2022/09/22 12:10:08 |
コンテスト | 第2回 SQLコンテスト |
問題 | 就学状況の表示変換 |
受験者 | hiromi_n |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 99 MB |
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
99 MB
データパターン2
WA
96 MB