ソースコード
select
    AGE.AGE_NAME     as "年齢階層"
   ,T120.NumOfPeaple as "5時間未満"
   ,T130.NumOfPeaple as "5時間以上6時間未満"
   ,T140.NumOfPeaple as "6時間以上7時間未満"
   ,T150.NumOfPeaple as "7時間以上8時間未満"
   ,T160.NumOfPeaple as "8時間以上9時間未満"
   ,T170.NumOfPeaple as "9時間以上"
   ,T180.NumOfPeaple as "不詳"
from
    AGE_GRP    AGE
   ,(select
        AGE.AGE_CODE
       ,SUM(STD.TARGET_POP) as NumOfPeaple
    from
        SLEEP_TIME_DTL STD
    left join
        AGE_GRP    AGE
    on  AGE.AGE_CODE = STD.AGE_CODE
    where
        STD.TIME_CODE = 120
    group by
        AGE.AGE_CODE
    ) T120
   ,(select
        AGE.AGE_CODE
       ,SUM(STD.TARGET_POP) as NumOfPeaple
    from
        SLEEP_TIME_DTL STD
    left join
        AGE_GRP    AGE
    on  AGE.AGE_CODE = STD.AGE_CODE
    where
        STD.TIME_CODE = 130
    group by
        AGE.AGE_CODE
    ) T130
   ,(select
        AGE.AGE_CODE
       ,SUM(STD.TARGET_POP) as NumOfPeaple
    from
        SLEEP_TIME_DTL STD
    left join
        AGE_GRP    AGE
    on  AGE.AGE_CODE = STD.AGE_CODE
    where
        STD.TIME_CODE = 140
    group by
        AGE.AGE_CODE
    ) T140
   ,(select
        AGE.AGE_CODE
       ,SUM(STD.TARGET_POP) as NumOfPeaple
    from
        SLEEP_TIME_DTL STD
    left join
        AGE_GRP    AGE
    on  AGE.AGE_CODE = STD.AGE_CODE
    where
        STD.TIME_CODE = 150
    group by
        AGE.AGE_CODE
    ) T150
   ,(select
        AGE.AGE_CODE
       ,SUM(STD.TARGET_POP) as NumOfPeaple
    from
        SLEEP_TIME_DTL STD
    left join
        AGE_GRP    AGE
    on  AGE.AGE_CODE = STD.AGE_CODE
    where
        STD.TIME_CODE = 160
    group by
        AGE.AGE_CODE
    ) T160
   ,(select
        AGE.AGE_CODE
       ,SUM(STD.TARGET_POP) as NumOfPeaple
    from
        SLEEP_TIME_DTL STD
    left join
        AGE_GRP    AGE
    on  AGE.AGE_CODE = STD.AGE_CODE
    where
        STD.TIME_CODE = 170
    group by
        AGE.AGE_CODE
    ) T170
   ,(select
        AGE.AGE_CODE
       ,SUM(STD.TARGET_POP) as NumOfPeaple
    from
        SLEEP_TIME_DTL STD
    left join
        AGE_GRP    AGE
    on  AGE.AGE_CODE = STD.AGE_CODE
    where
        STD.TIME_CODE = 180
    group by
        AGE.AGE_CODE
    ) T180
where
    T120.AGE_CODE = AGE.AGE_CODE
and T130.AGE_CODE = AGE.AGE_CODE
and T140.AGE_CODE = AGE.AGE_CODE
and T150.AGE_CODE = AGE.AGE_CODE
and T160.AGE_CODE = AGE.AGE_CODE
and T170.AGE_CODE = AGE.AGE_CODE
and T180.AGE_CODE = AGE.AGE_CODE
order by
    AGE.AGE_CODE
提出情報
提出日時2023/06/16 23:28:25
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者shogidemo
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
84 MB
データパターン2
AC
79 MB