ソースコード
with sleep_hours_by_age as (
    select
        AG.age_code,
        sum(case when time_code = 120 then target_pop else 0 end) as lt5,
        sum(case when time_code = 130 then target_pop else 0 end) as gte5,
        sum(case when time_code = 140 then target_pop else 0 end) as gte6,
        sum(case when time_code = 150 then target_pop else 0 end) as gte7,
        sum(case when time_code = 160 then target_pop else 0 end) as gte8,
        sum(case when time_code = 170 then target_pop else 0 end) as gte9,
        sum(case when time_code = 180 then target_pop else 0 end) as unknown
    from
        age_grp AG
        join sleep_time_dtl STD
        on AG.age_code = STD.age_code
    group by
        AG.age_code
)
select
    AG.age_name as 年齢階層,
    SH.lt5 as "5時間未満",
    SH.gte5 as "5時間以上6時間未満",
    SH.gte6 as "6時間以上7時間未満",
    SH.gte7 as "7時間以上8時間未満",
    SH.gte8 as "8時間以上9時間未満",
    SH.gte9 as "9時間以上",
    SH.unknown as 不詳
from
    sleep_hours_by_age SH
    inner join age_grp AG
    on SH.age_code = AG.age_code
order by
    SH.age_code
;
提出情報
提出日時2022/07/18 16:55:12
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者tekihei2317
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量81 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
81 MB
データパターン2
AC
79 MB