ソースコード
with target_120 as (
    select
        AGE_CODE,
        sum(TARGET_POP) as TARGET_POP
    from
        SLEEP_TIME_DTL
    where
        TIME_CODE = 120
    group by
        1
),
target_130 as (
    select
        AGE_CODE,
        sum(TARGET_POP) as TARGET_POP
    from
        SLEEP_TIME_DTL
    where
        TIME_CODE = 130
    group by
        1
),
target_140 as (
    select
        AGE_CODE,
        sum(TARGET_POP) as TARGET_POP
    from
        SLEEP_TIME_DTL
    where
        TIME_CODE = 140
    group by
        1
),
target_150 as (
    select
        AGE_CODE,
        sum(TARGET_POP) as TARGET_POP
    from
        SLEEP_TIME_DTL
    where
        TIME_CODE = 150
    group by
        1
),
target_160 as (
    select
        AGE_CODE,
        sum(TARGET_POP) as TARGET_POP
    from
        SLEEP_TIME_DTL
    where
        TIME_CODE = 160
    group by
        1
),
target_170 as (
    select
        AGE_CODE,
        sum(TARGET_POP) as TARGET_POP
    from
        SLEEP_TIME_DTL
    where
        TIME_CODE = 170
    group by
        1
),
target_180 as (
    select
        AGE_CODE,
        sum(TARGET_POP) as TARGET_POP
    from
        SLEEP_TIME_DTL
    where
        TIME_CODE = 180
    group by
        1
)

select
    ag.AGE_NAME,
    target_120.TARGET_POP as `5時間未満`,
    target_130.TARGET_POP as `5時間以上6時間未満`,
    target_140.TARGET_POP as `6時間以上7時間未満`,
    target_150.TARGET_POP as `7時間以上8時間未満`,
    target_160.TARGET_POP as `8時間以上9時間未満`,
    target_170.TARGET_POP as `9時間以上`,
    target_180.TARGET_POP as `不詳`
from
    AGE_GRP as ag
inner join
    target_120
    on target_120.AGE_CODE = ag.AGE_CODE
inner join
    target_130
    on target_130.AGE_CODE = ag.AGE_CODE
inner join
    target_140
    on target_140.AGE_CODE = ag.AGE_CODE
inner join
    target_150
    on target_150.AGE_CODE = ag.AGE_CODE
inner join
    target_160
    on target_160.AGE_CODE = ag.AGE_CODE
inner join
    target_170
    on target_170.AGE_CODE = ag.AGE_CODE
inner join
    target_180
    on target_180.AGE_CODE = ag.AGE_CODE
order by
    ag.AGE_CODE
提出情報
提出日時2022/06/29 11:28:32
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者suk1yak1
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量78 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
78 MB
データパターン2
WA
77 MB