ソースコード

SELECT 
    base.AGE_NAME AS "年齢階層"
    ,MAX("5時間未満") AS "5時間未満"
    ,MAX("5時間以上6時間未満") AS "5時間以上6時間未満"
    ,MAX("6時間以上7時間未満") AS "6時間以上7時間未満"
    ,MAX("7時間以上8時間未満") AS "7時間以上8時間未満"
    ,MAX("8時間以上9時間未満") AS "8時間以上9時間未満"
    ,MAX("9時間以上") AS "9時間以上"
    ,MAX("不詳") AS "不詳"
FROM (
    SELECT
        std.AGE_CODE
        ,ag.AGE_NAME
        ,std.TIME_CODE
        , CASE WHEN std.TIME_CODE = 120 THEN sum(std.TARGET_POP) END AS "5時間未満"
        , CASE WHEN std.TIME_CODE = 130 THEN sum(std.TARGET_POP) END AS "5時間以上6時間未満"
        , CASE WHEN std.TIME_CODE = 140 THEN sum(std.TARGET_POP) END AS "6時間以上7時間未満"
        , CASE WHEN std.TIME_CODE = 150 THEN sum(std.TARGET_POP) END AS "7時間以上8時間未満"
        , CASE WHEN std.TIME_CODE = 160 THEN sum(std.TARGET_POP) END AS "8時間以上9時間未満"
        , CASE WHEN std.TIME_CODE = 170 THEN sum(std.TARGET_POP) END AS "9時間以上"
        , CASE WHEN std.TIME_CODE = 180 THEN sum(std.TARGET_POP) END AS "不詳"
    FROM 
        SLEEP_TIME_DTL AS std
    JOIN AGE_GRP AS ag ON std.AGE_CODE = ag.AGE_CODE
    Group By
        std.AGE_CODE 
        ,std.TIME_CODE
    ORDER BY
        std.AGE_CODE, std.TIME_CODE
    ) AS base
GROUP BY base.AGE_CODE

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