ソースコード
WITH SUBSUM AS (
    SELECT
        T1.AGE_CODE                                                     AS AGE_CODE
      , SUM(CASE WHEN T1.TIME_CODE = 120 THEN T1.TARGET_POP ELSE 0 END) AS SUM120
      , SUM(CASE WHEN T1.TIME_CODE = 130 THEN T1.TARGET_POP ELSE 0 END) AS SUM130
      , SUM(CASE WHEN T1.TIME_CODE = 140 THEN T1.TARGET_POP ELSE 0 END) AS SUM140
      , SUM(CASE WHEN T1.TIME_CODE = 150 THEN T1.TARGET_POP ELSE 0 END) AS SUM150
      , SUM(CASE WHEN T1.TIME_CODE = 160 THEN T1.TARGET_POP ELSE 0 END) AS SUM160
      , SUM(CASE WHEN T1.TIME_CODE = 170 THEN T1.TARGET_POP ELSE 0 END) AS SUM170
      , SUM(CASE WHEN T1.TIME_CODE = 180 THEN T1.TARGET_POP ELSE 0 END) AS SUM180
    FROM
        SLEEP_TIME_DTL T1
    GROUP BY
        T1.AGE_CODE
)
SELECT
    M1.AGE_NAME AS "年齢階層"
  , T1.SUM120   AS "5時間未満"
  , T1.SUM130   AS "5時間以上6時間未満"
  , T1.SUM140   AS "6時間以上7時間未満"
  , T1.SUM150   AS "7時間以上8時間未満"
  , T1.SUM160   AS "8時間以上9時間未満"
  , T1.SUM170   AS "9時間以上"
  , T1.SUM180   AS "不詳"
FROM
    SUBSUM T1
    LEFT OUTER JOIN AGE_GRP M1
        ON T1.AGE_CODE = M1.AGE_CODE
ORDER BY
    T1.AGE_CODE
;
提出情報
提出日時2022/09/21 12:13:06
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者kntky98
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量87 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
87 MB
データパターン2
AC
87 MB