コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
select SURVEY_YEAR as SV_YEAR
, PF_NAME as PREFECTURE
, KIND
, AMT
from (
select e.SURVEY_YEAR, p.PF_NAME, p.PF_CODE
,1 as sk, "小学校" as KIND, sum(e.ELEMENTARY) as AMT
from ENROLLMENT_STATUS e
inner join PREFECTURE p
on p.PF_CODE = e.PF_CODE
where e.SURVEY_YEAR = 2020 and e.ELEMENTARY > 0
group by e.SURVEY_YEAR, p.PF_NAME, p.PF_CODE
union all
select e.SURVEY_YEAR, p.PF_NAME, p.PF_CODE
,2 as sk, "中学校" as KIND, sum(e.MIDDLE) as AMT
from ENROLLMENT_STATUS e
inner join PREFECTURE p
on p.PF_CODE = e.PF_CODE
where e.SURVEY_YEAR = 2020 and e.MIDDLE > 0
group by e.SURVEY_YEAR, p.PF_NAME, p.PF_CODE
union all
select e.SURVEY_YEAR, p.PF_NAME, p.PF_CODE
,3 as sk, "高校" as KIND, sum(e.HIGH) as AMT
from ENROLLMENT_STATUS e
inner join PREFECTURE p
on p.PF_CODE = e.PF_CODE
where e.SURVEY_YEAR = 2020 and e.HIGH > 0
group by e.SURVEY_YEAR, p.PF_NAME, p.PF_CODE
union all
select e.SURVEY_YEAR, p.PF_NAME, p.PF_CODE
,4 as sk, "短大" as KIND, sum(e.JUNIOR_CLG) as AMT
from ENROLLMENT_STATUS e
inner join PREFECTURE p
on p.PF_CODE = e.PF_CODE
where e.SURVEY_YEAR = 2020 and e.JUNIOR_CLG > 0
group by e.SURVEY_YEAR, p.PF_NAME, p.PF_CODE
union all
select e.SURVEY_YEAR, p.PF_NAME, p.PF_CODE
,5 as sk, "大学" as KIND, sum(e.COLLEGE) as AMT
from ENROLLMENT_STATUS e
inner join PREFECTURE p
on p.PF_CODE = e.PF_CODE
where e.SURVEY_YEAR = 2020 and e.COLLEGE>0
group by e.SURVEY_YEAR, p.PF_NAME, p.PF_CODE
union all
select e.SURVEY_YEAR, p.PF_NAME, p.PF_CODE
,6 as sk, "大学院" as KIND, sum(e.GRADUATE) as AMT
from ENROLLMENT_STATUS e
inner join PREFECTURE p
on p.PF_CODE = e.PF_CODE
where e.SURVEY_YEAR = 2020 and e.GRADUATE > 0
group by e.SURVEY_YEAR, p.PF_NAME, p.PF_CODE
)
order by PF_CODE
, sk
提出情報
提出日時 | 2022/09/22 00:13:38 |
コンテスト | 第2回 SQLコンテスト |
問題 | 就学状況の表示変換 |
受験者 | kiharu |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 96 MB |
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
87 MB
データパターン2
AC
96 MB