ソースコード
WITH SUBSUM AS (
    SELECT
        T1.AGE_CODE           AS AGE_CODE
      , SUM(T1.SP_TIME_5)     AS SUM5
      , SUM(T1.SP_TIME_6)     AS SUM6
      , SUM(T1.SP_TIME_7)     AS SUM7
      , SUM(T1.SP_TIME_8)     AS SUM8
      , SUM(T1.SP_TIME_9)     AS SUM9
      , SUM(T1.SP_TIME_9OVER) AS SUM9OVER
    FROM
        SLEEP_TIME_DTL T1
    WHERE
        T1.PF_CODE IN ('01000'
                     , '02000'
                     , '03000'
                     , '04000'
                     , '07000'
                     )
    GROUP BY
        T1.AGE_CODE
)
SELECT
    T1.AGE_CODE AS "年齢コード"
  , M1.AGE_NAME AS "年齢階層名"
  , T1.SUM5     AS "5時間未満"
  , T1.SUM6     AS "5時間以上6時間未満"
  , T1.SUM7     AS "6時間以上7時間未満"
  , T1.SUM8     AS "7時間以上8時間未満"
  , T1.SUM9     AS "8時間以上9時間未満"
  , T1.SUM9OVER AS "9時間以上"
FROM
    SUBSUM T1
    INNER JOIN AGE_GRP M1
        ON T1.AGE_CODE = M1.AGE_CODE
ORDER BY
    T1.AGE_CODE
;
提出情報
提出日時2022/09/21 16:48:41
コンテスト第1回 SQLコンテスト
問題睡眠時間帯別集計
受験者kntky98
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量102 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
102 MB
データパターン2
AC
100 MB