ソースコード
SELECT
  AG.AGE_NAME AS 年齢階層
  , TC120.POP AS "5時間未満"
  , TC130.POP AS "5時間以上6時間未満"
  , TC140.POP AS "6時間以上7時間未満"
  , TC150.POP AS "7時間以上8時間未満"
  , TC160.POP AS "8時間以上9時間未満"
  , TC170.POP AS "9時間以上"
  , TC180.POP AS 不詳
FROM
  (
    SELECT
      AGE_CODE
      , TIME_CODE
      , SUM(TARGET_POP) AS POP
    FROM
      SLEEP_TIME_DTL
    WHERE
      TIME_CODE = 120
    GROUP BY
      AGE_CODE
  ) AS TC120
  INNER JOIN
  (
    SELECT
      AGE_CODE
      , TIME_CODE
      , SUM(TARGET_POP) AS POP
    FROM
      SLEEP_TIME_DTL
    WHERE
      TIME_CODE = 130
    GROUP BY
      AGE_CODE
  ) AS TC130
  ON TC120.AGE_CODE = TC130.AGE_CODE
  INNER JOIN
  (
    SELECT
      AGE_CODE
      , TIME_CODE
      , SUM(TARGET_POP) AS POP
    FROM
      SLEEP_TIME_DTL
    WHERE
      TIME_CODE = 140
    GROUP BY
      AGE_CODE
  ) AS TC140
  ON TC120.AGE_CODE = TC140.AGE_CODE
  INNER JOIN
  (
    SELECT
      AGE_CODE
      , TIME_CODE
      , SUM(TARGET_POP) AS POP
    FROM
      SLEEP_TIME_DTL
    WHERE
      TIME_CODE = 150
    GROUP BY
      AGE_CODE
  ) AS TC150
  ON TC120.AGE_CODE = TC150.AGE_CODE
  INNER JOIN
  (
    SELECT
      AGE_CODE
      , TIME_CODE
      , SUM(TARGET_POP) AS POP
    FROM
      SLEEP_TIME_DTL
    WHERE
      TIME_CODE = 160
    GROUP BY
      AGE_CODE
  ) AS TC160
  ON TC120.AGE_CODE = TC160.AGE_CODE
  INNER JOIN
  (
    SELECT
      AGE_CODE
      , TIME_CODE
      , SUM(TARGET_POP) AS POP
    FROM
      SLEEP_TIME_DTL
    WHERE
      TIME_CODE = 170
    GROUP BY
      AGE_CODE
  ) AS TC170
  ON TC120.AGE_CODE = TC170.AGE_CODE
  INNER JOIN
  (
    SELECT
      AGE_CODE
      , TIME_CODE
      , SUM(TARGET_POP) AS POP
    FROM
      SLEEP_TIME_DTL
    WHERE
      TIME_CODE = 180
    GROUP BY
      AGE_CODE
  ) AS TC180
  ON TC120.AGE_CODE = TC180.AGE_CODE
LEFT OUTER JOIN AGE_GRP AS AG
  ON TC120.AGE_CODE = AG.AGE_CODE
LEFT OUTER JOIN SLEEP_TIME AS ST
  ON TC120.TIME_CODE = ST.TIME_CODE
ORDER BY
  TC120.AGE_CODE
;
提出情報
提出日時2023/06/17 22:49:02
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者mike_ph
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量89 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
89 MB
データパターン2
AC
87 MB