コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
with sleep_sum as(
select a.age_code ,sum(target_pop) as sum_120 ,0 as sum_130 ,0 as sum_140, 0 as sum_150 ,0 as sum_160 ,0 as sum_170 ,0 as sum_180 from sleep_time_dtl a inner join sleep_time b on a.time_code = b.time_code where a.time_code = '120' group by a.age_code
union all
select a.age_code ,0 as sum_120, sum(target_pop) as sum_130 ,0 as sum_140, 0 as sum_150 ,0 as sum_160 ,0 as sum_170 ,0 as sum_180 from sleep_time_dtl a inner join sleep_time b on a.time_code = b.time_code where a.time_code = '130' group by a.age_code
union all
select a.age_code ,0 as sum_120 ,0 as sum_130 ,sum(target_pop) as sum_140, 0 as sum_150 ,0 as sum_160 ,0 as sum_170 ,0 as sum_180 from sleep_time_dtl a inner join sleep_time b on a.time_code = b.time_code where a.time_code = '140' group by a.age_code
union all
select a.age_code ,0 as sum_120, 0 as sum_130 ,0 as sum_140, sum(target_pop) as sum_150 ,0 as sum_160 ,0 as sum_170 ,0 as sum_180 from sleep_time_dtl a inner join sleep_time b on a.time_code = b.time_code where a.time_code = '150' group by a.age_code
union all
select a.age_code ,0 as sum_120 ,0 as sum_130 ,0 as sum_140, 0 as sum_150 ,sum(target_pop) as sum_160 ,0 as sum_170 ,0 as sum_180 from sleep_time_dtl a inner join sleep_time b on a.time_code = b.time_code where a.time_code = '160' group by a.age_code
union all
select a.age_code ,0 as sum_120 ,0 as sum_130 ,0 as sum_140, 0 as sum_150 ,0 as sum_160 ,sum(target_pop) as sum_170 ,0 as sum_180 from sleep_time_dtl a inner join sleep_time b on a.time_code = b.time_code where a.time_code = '170' group by a.age_code
union all
select a.age_code ,0 as sum_120 ,0 as sum_130 ,0 as sum_140, 0 as sum_150 ,0 as sum_160 ,0 as sum_170 ,sum(target_pop) as sum_180 from sleep_time_dtl a inner join sleep_time b on a.time_code = b.time_code where a.time_code = '180' group by a.age_code
)
select
a.age_name as "年齢階層"
,sum(b.sum_120) as "5時間未満"
,sum(b.sum_130) as "5時間以上6時間未満"
,sum(b.sum_140) as "6時間以上7時間未満"
,sum(b.sum_150) as "7時間以上8時間未満"
,sum(b.sum_160) as "8時間以上9時間未満"
,sum(b.sum_170) as "9時間以上"
,sum(b.sum_180) as "不詳"
from
age_grp a
inner join sleep_sum b
on a.age_code = b.age_code
group by
a.age_name
order by
"年齢階層"
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
79 MB
データパターン2
AC
76 MB