コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
with sho as(
select PF_CODE, sum (ELEMENTARY) as AMT, "小学校" as KIND, 1 as num from ENROLLMENT_STATUS
where SURVEY_YEAR = 2020
group by PF_CODE
), chu as(
select PF_CODE, sum (MIDDLE) as AMT, "中学校" as KIND,2 as num from ENROLLMENT_STATUS
where SURVEY_YEAR = 2020
group by PF_CODE
), kou as (
select PF_CODE, sum (HIGH) as AMT, "高校" as KIND,3 as num from ENROLLMENT_STATUS
where SURVEY_YEAR = 2020
group by PF_CODE
), jun as (
select PF_CODE, sum (JUNIOR_CLG) as AMT, "短大" as KIND,4 as num from ENROLLMENT_STATUS
where SURVEY_YEAR = 2020
group by PF_CODE
), col as(
select PF_CODE, sum (COLLEGE) as AMT, "大学" as KIND,5 as num from ENROLLMENT_STATUS
where SURVEY_YEAR = 2020
group by PF_CODE
), gra as(
select PF_CODE, sum (GRADUATE) as AMT, "大学院" as KIND,6 as num from ENROLLMENT_STATUS
where SURVEY_YEAR = 2020
group by PF_CODE
), tmp as(
select * from sho
union all
select * from chu
union all
select * from kou
union all
select * from jun
union all
select * from col
union all
select * from gra
)
select 2020 as SV_YEAR , p.PF_NAME as PREFECTURE, t.KIND, t.AMT from PREFECTURE p
left join tmp t on p.PF_CODE = t.PF_CODE
where t.AMT is not null
order by p.PF_CODE, t.num
提出情報
提出日時 | 2022/09/22 00:04:41 |
コンテスト | 第2回 SQLコンテスト |
問題 | 就学状況の表示変換 |
受験者 | birt |
状態 (詳細) | AC (Accepted: 正答) |
メモリ使用量 | 94 MB |
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
94 MB
データパターン2
AC
78 MB