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