ソースコード
WITH GREP as (
    SELECT
        AGE_CODE as AC,
        SUM(SP_TIME_5) as ST5,
        SUM(SP_TIME_6) as ST6,
        SUM(SP_TIME_7) as ST7,
        SUM(SP_TIME_8) as ST8,
        SUM(SP_TIME_9) as ST9,
        SUM(SP_TIME_9OVER) as ST9O
        FROM SLEEP_TIME_DTL
        WHERE PF_CODE <= '07000' and PF_CODE <> '05000' and PF_CODE <> '06000'
        GROUP BY AGE_CODE
)
SELECT
    AG.AGE_CODE as 年齢コード,
    AG.AGE_NAME as 年齢階層名,
    G.ST5 as "5時間未満",
    G.ST6 as "5時間以上6時間未満",
    G.ST7 as "6時間以上7時間未満",
    G.ST8 as "7時間以上8時間未満",
    G.ST9 as "8時間以上9時間未満",
    G.ST9O as "9時間以上"
FROM AGE_GRP as AG
INNER JOIN GREP as G on AG.AGE_CODE = G.AC
ORDER BY AG.AGE_CODE ASC 
提出情報
提出日時2022/10/24 13:01:58
コンテスト第1回 SQLコンテスト
問題睡眠時間帯別集計
受験者asd
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量77 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
77 MB
データパターン2
AC
76 MB