ソースコード
WITH
  S120 AS (SELECT AGE_CODE, SUM(IFNULL(TARGET_POP, 0)) TARGET_POP FROM SLEEP_TIME_DTL WHERE TIME_CODE = 120 GROUP BY AGE_CODE),
  S130 AS (SELECT AGE_CODE, SUM(IFNULL(TARGET_POP, 0)) TARGET_POP FROM SLEEP_TIME_DTL WHERE TIME_CODE = 130 GROUP BY AGE_CODE),
  S140 AS (SELECT AGE_CODE, SUM(IFNULL(TARGET_POP, 0)) TARGET_POP FROM SLEEP_TIME_DTL WHERE TIME_CODE = 140 GROUP BY AGE_CODE),
  S150 AS (SELECT AGE_CODE, SUM(IFNULL(TARGET_POP, 0)) TARGET_POP FROM SLEEP_TIME_DTL WHERE TIME_CODE = 150 GROUP BY AGE_CODE),
  S160 AS (SELECT AGE_CODE, SUM(IFNULL(TARGET_POP, 0)) TARGET_POP FROM SLEEP_TIME_DTL WHERE TIME_CODE = 160 GROUP BY AGE_CODE),
  S170 AS (SELECT AGE_CODE, SUM(IFNULL(TARGET_POP, 0)) TARGET_POP FROM SLEEP_TIME_DTL WHERE TIME_CODE = 170 GROUP BY AGE_CODE),
  S180 AS (SELECT AGE_CODE, SUM(IFNULL(TARGET_POP, 0)) TARGET_POP FROM SLEEP_TIME_DTL WHERE TIME_CODE = 180 GROUP BY AGE_CODE)
SELECT
  AGE_GRP.AGE_NAME '年齢階層',
  S120.TARGET_POP '5時間未満',
  S130.TARGET_POP '5時間以上6時間未満',
  S140.TARGET_POP '6時間以上7時間未満',
  S150.TARGET_POP '7時間以上8時間未満',
  S160.TARGET_POP '8時間以上9時間未満',
  S170.TARGET_POP '9時間以上',
  S180.TARGET_POP '不詳'
FROM
  AGE_GRP
  JOIN S120 ON AGE_GRP.AGE_CODE = S120.AGE_CODE
  JOIN S130 ON AGE_GRP.AGE_CODE = S130.AGE_CODE
  JOIN S140 ON AGE_GRP.AGE_CODE = S140.AGE_CODE
  JOIN S150 ON AGE_GRP.AGE_CODE = S150.AGE_CODE
  JOIN S160 ON AGE_GRP.AGE_CODE = S160.AGE_CODE
  JOIN S170 ON AGE_GRP.AGE_CODE = S170.AGE_CODE
  JOIN S180 ON AGE_GRP.AGE_CODE = S180.AGE_CODE
ORDER BY AGE_GRP.AGE_CODE
提出情報
提出日時2022/12/18 04:47:05
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者jbking
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量80 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
80 MB
データパターン2
AC
78 MB