ソースコード
with tmp as(
select
    age_code
    ,time_code
    ,sum(target_pop) as target_pop
from
    sleep_time_dtl
group by
    age_code,time_code
)

select
    ag.age_name as '年齢階層'
    ,s120.target_pop as '5時間未満'
    ,s130.target_pop as '5時間以上6時間未満'
    ,s140.target_pop as '6時間以上7時間未満'
    ,s150.target_pop as '7時間以上8時間未満'
    ,s160.target_pop as '8時間以上9時間未満'
    ,s170.target_pop as '9時間以上'
    ,s180.target_pop as '不詳'
from
    tmp as s120
    
cross join tmp as s130
cross join tmp as s140
cross join tmp as s150
cross join tmp as s160
cross join tmp as s170
cross join tmp as s180

inner join age_grp ag
    on s120.age_code = ag.age_code

where
    s120.time_code = 120
    and s130.time_code = 130
    and s140.time_code = 140
    and s150.time_code = 150
    and s160.time_code = 160
    and s170.time_code = 170
    and s180.time_code = 180
    and s120.age_code = s130.age_code
    and s120.age_code = s140.age_code
    and s120.age_code = s150.age_code
    and s120.age_code = s160.age_code
    and s120.age_code = s170.age_code
    and s120.age_code = s180.age_code

order by
    s120.age_code asc


    
提出情報
提出日時2023/07/06 16:53:31
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者mywk
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量79 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
79 MB
データパターン2
AC
77 MB