ソースコード
select
  AGE_GRP.AGE_NAME AS '年齢階層',
  STD_120.TARGET_POP AS '5時間未満',
  STD_130.TARGET_POP AS '5時間以上6時間未満',
  STD_140.TARGET_POP AS '6時間以上7時間未満',
  STD_150.TARGET_POP AS '7時間以上8時間未満',
  STD_160.TARGET_POP AS '8時間以上9時間未満',
  STD_170.TARGET_POP AS '9時間以上',
  STD_180.TARGET_POP AS '不詳'

from
  (
    select
      AGE_CODE,
      SUM(TARGET_POP) AS TARGET_POP
    from
      SLEEP_TIME_DTL
    inner join SLEEP_TIME
      on SLEEP_TIME_DTL.TIME_CODE = SLEEP_TIME.TIME_CODE
    where
      SLEEP_TIME.TIME_CODE = 120
    group by
      AGE_CODE
  ) AS STD_120
inner join
  (
    select
      AGE_CODE,
      SUM(TARGET_POP) AS TARGET_POP
    from
      SLEEP_TIME_DTL
    inner join SLEEP_TIME
      on SLEEP_TIME_DTL.TIME_CODE = SLEEP_TIME.TIME_CODE
    where
      SLEEP_TIME.TIME_CODE = 130
    group by
      AGE_CODE
  ) AS STD_130
  on STD_120.AGE_CODE = STD_130.AGE_CODE
inner join
  (
    select
      AGE_CODE,
      SUM(TARGET_POP) AS TARGET_POP
    from
      SLEEP_TIME_DTL
    inner join SLEEP_TIME
      on SLEEP_TIME_DTL.TIME_CODE = SLEEP_TIME.TIME_CODE
    where
      SLEEP_TIME.TIME_CODE = 140
    group by
      AGE_CODE
  ) AS STD_140
  on STD_120.AGE_CODE = STD_140.AGE_CODE
inner join
  (
    select
      AGE_CODE,
      SUM(TARGET_POP) AS TARGET_POP
    from
      SLEEP_TIME_DTL
    inner join SLEEP_TIME
      on SLEEP_TIME_DTL.TIME_CODE = SLEEP_TIME.TIME_CODE
    where
      SLEEP_TIME.TIME_CODE = 150
    group by
      AGE_CODE
  ) AS STD_150
  on STD_120.AGE_CODE = STD_150.AGE_CODE
inner join
  (
    select
      AGE_CODE,
      SUM(TARGET_POP) AS TARGET_POP
    from
      SLEEP_TIME_DTL
    inner join SLEEP_TIME
      on SLEEP_TIME_DTL.TIME_CODE = SLEEP_TIME.TIME_CODE
    where
      SLEEP_TIME.TIME_CODE = 160
    group by
      AGE_CODE
  ) AS STD_160
  on STD_120.AGE_CODE = STD_160.AGE_CODE
inner join
  (
    select
      AGE_CODE,
      SUM(TARGET_POP) AS TARGET_POP
    from
      SLEEP_TIME_DTL
    inner join SLEEP_TIME
      on SLEEP_TIME_DTL.TIME_CODE = SLEEP_TIME.TIME_CODE
    where
      SLEEP_TIME.TIME_CODE = 170
    group by
      AGE_CODE
  ) AS STD_170
  on STD_120.AGE_CODE = STD_170.AGE_CODE
inner join
  (
    select
      AGE_CODE,
      SUM(TARGET_POP) AS TARGET_POP
    from
      SLEEP_TIME_DTL
    inner join SLEEP_TIME
      on SLEEP_TIME_DTL.TIME_CODE = SLEEP_TIME.TIME_CODE
    where
      SLEEP_TIME.TIME_CODE = 180
    group by
      AGE_CODE
  ) AS STD_180
  on STD_120.AGE_CODE = STD_180.AGE_CODE
inner join
  AGE_GRP
  on STD_120.AGE_CODE = AGE_GRP.AGE_CODE
order by 
  AGE_GRP.AGE_CODE asc
提出情報
提出日時2022/07/15 13:08:20
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者sakula9384
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量79 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
79 MB
データパターン2
AC
77 MB