ソースコード
select 
ag.AGE_NAME as 年齢階層,
t.TIME_CODE_120 as '5時間未満',
t.TIME_CODE_130 as '5時間以上6時間未満',
t.TIME_CODE_140 as  '6時間以上7時間未満',
t.TIME_CODE_150 as  '7時間以上8時間未満',
t.TIME_CODE_160 as  '8時間以上9時間未満',
t.TIME_CODE_170 as '9時間以上',
t.TIME_CODE_180 as '不詳'
from 
(
select
sl.AGE_CODE as AGE_CODE,
sum(case when sl.TIME_CODE = 120 then sl.TARGET_POP else 0 end) TIME_CODE_120,
sum(case when sl.TIME_CODE = 130 then sl.TARGET_POP else 0 end) TIME_CODE_130,
sum(case when sl.TIME_CODE = 140 then sl.TARGET_POP else 0 end) TIME_CODE_140,
sum(case when sl.TIME_CODE = 150 then sl.TARGET_POP else 0 end) TIME_CODE_150,
sum(case when sl.TIME_CODE = 160 then sl.TARGET_POP else 0 end) TIME_CODE_160,
sum(case when sl.TIME_CODE = 170 then sl.TARGET_POP else 0 end) TIME_CODE_170,
sum(case when sl.TIME_CODE = 180 then sl.TARGET_POP else 0 end) TIME_CODE_180
from SLEEP_TIME_DTL sl
GROUP BY sl.AGE_CODE
) t 
join AGE_GRP ag
on t.AGE_CODE = ag.AGE_CODE
order by t.AGE_CODE
提出情報
提出日時2022/07/20 15:54:29
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者zio-dev
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量94 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
78 MB
データパターン2
AC
94 MB