ソースコード
select
    AGE_NAME as 年齢階層,
    TARGET_POP_5h as `5時間未満`,
    TARGET_POP_5h_6h as `5時間以上6時間未満`,
    TARGET_POP_6h_7h as `6時間以上7時間未満`,
    TARGET_POP_7h_8h as `7時間以上8時間未満`,
    TARGET_POP_8h_9h as `8時間以上9時間未満`,
    TARGET_POP_9h as `9時間以上`,
    TARGET_POP_UNKNOWN as `不詳`
from
    AGE_GRP
inner join
    (
        select
            AGE_CODE,
            sum(TARGET_POP) as TARGET_POP_5h
        from
            SLEEP_TIME_DTL
        where
            TIME_CODE = 120
        group by
            AGE_CODE
    ) as AG_SLEEP_TIME_DTL_5h
using(AGE_CODE)
inner join
    (
        select
            AGE_CODE,
            sum(TARGET_POP) as TARGET_POP_5h_6h
        from
            SLEEP_TIME_DTL
        where
            TIME_CODE = 130
        group by
            AGE_CODE
    ) as AG_SLEEP_TIME_DTL_5h_6h
using(AGE_CODE)
inner join
    (
        select
            AGE_CODE,
            sum(TARGET_POP) as TARGET_POP_6h_7h
        from
            SLEEP_TIME_DTL
        where
            TIME_CODE = 140
        group by
            AGE_CODE
    ) as AG_SLEEP_TIME_DTL_6h_7h
using(AGE_CODE)
inner join
    (
        select
            AGE_CODE,
            sum(TARGET_POP) as TARGET_POP_7h_8h
        from
            SLEEP_TIME_DTL
        where
            TIME_CODE = 150
        group by
            AGE_CODE
    ) as AG_SLEEP_TIME_DTL_7h_8h
using(AGE_CODE)
inner join
    (
        select
            AGE_CODE,
            sum(TARGET_POP) as TARGET_POP_8h_9h
        from
            SLEEP_TIME_DTL
        where
            TIME_CODE = 160
        group by
            AGE_CODE
    ) as AG_SLEEP_TIME_DTL_8h_9h
using(AGE_CODE)
inner join
    (
        select
            AGE_CODE,
            sum(TARGET_POP) as TARGET_POP_9h
        from
            SLEEP_TIME_DTL
        where
            TIME_CODE = 170
        group by
            AGE_CODE
    ) as AG_SLEEP_TIME_DTL_9h
using(AGE_CODE)
inner join
    (
        select
            AGE_CODE,
            sum(TARGET_POP) as TARGET_POP_UNKNOWN
        from
            SLEEP_TIME_DTL
        where
            TIME_CODE = 180
        group by
            AGE_CODE
    ) as AG_SLEEP_TIME_DTL_UNKNOWN
using(AGE_CODE)
提出情報
提出日時2023/06/12 18:57:17
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者pon-taro
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量82 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
81 MB
データパターン2
AC
82 MB