ソースコード
with dtl as (
select
    AGE_CODE,
    sum(SP_TIME_5) as SP_TIME_5, 
    sum(SP_TIME_6) as SP_TIME_6, 
    sum(SP_TIME_7) as SP_TIME_7, 
    sum(SP_TIME_8) as SP_TIME_8, 
    sum(SP_TIME_9) as SP_TIME_9, 
    sum(SP_TIME_9OVER) as SP_TIME_9OVER
from
    SLEEP_TIME_DTL
where
    PF_CODE in ("01000","02000","03000","04000","07000")
group by
    AGE_CODE
)
select
    dtl.AGE_CODE as "年齢コード",
    a.AGE_NAME as "年齢階層名",
    dtl.SP_TIME_5 as "5時間未満",
    dtl.SP_TIME_6 as "5時間以上6時間未満",
    dtl.SP_TIME_7 as "6時間以上7時間未満",
    dtl.SP_TIME_8 as "7時間以上8時間未満",
    dtl.SP_TIME_9 as "8時間以上9時間未満",
    dtl.SP_TIME_9OVER as "9時間以上"
from
    dtl
    inner join
    AGE_GRP as a
    on dtl.AGE_CODE=a.AGE_CODE
order by
    dtl.AGE_CODE
提出情報
提出日時2024/03/07 18:18:56
コンテスト第1回 SQLコンテスト
問題睡眠時間帯別集計
受験者gP2fWnUzTL
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
84 MB
データパターン2
AC
83 MB