ソースコード
SELECT
    AGE_GRP.AGE_NAME AS `年齢階層`,
    SUM(SLEEP_TIME_120.TARGET_POP) AS `5時間未満`,
    SUM(SLEEP_TIME_130.TARGET_POP) AS `5時間以上6時間未満`,
    SUM(SLEEP_TIME_140.TARGET_POP) AS `6時間以上7時間未満`,
    SUM(SLEEP_TIME_150.TARGET_POP) AS `7時間以上8時間未満`,
    SUM(SLEEP_TIME_160.TARGET_POP) AS `8時間以上9時間未満`,
    SUM(SLEEP_TIME_170.TARGET_POP) AS `9時間以上`,
    SUM(SLEEP_TIME_180.TARGET_POP) AS `不詳`
FROM
    AGE_GRP
INNER JOIN
    (SELECT AGE_CODE, SUM(TARGET_POP) AS TARGET_POP FROM SLEEP_TIME_DTL WHERE TIME_CODE = 120 GROUP BY AGE_CODE) AS
    SLEEP_TIME_120 ON
    SLEEP_TIME_120.AGE_CODE = AGE_GRP.AGE_CODE
INNER JOIN
    (SELECT AGE_CODE, SUM(TARGET_POP) AS TARGET_POP FROM SLEEP_TIME_DTL WHERE TIME_CODE = 130 GROUP BY AGE_CODE) AS
    SLEEP_TIME_130 ON
    SLEEP_TIME_130.AGE_CODE = AGE_GRP.AGE_CODE
INNER JOIN
    (SELECT AGE_CODE, SUM(TARGET_POP) AS TARGET_POP FROM SLEEP_TIME_DTL WHERE TIME_CODE = 140 GROUP BY AGE_CODE) AS
    SLEEP_TIME_140 ON
    SLEEP_TIME_140.AGE_CODE = AGE_GRP.AGE_CODE
INNER JOIN
    (SELECT AGE_CODE, SUM(TARGET_POP) AS TARGET_POP FROM SLEEP_TIME_DTL WHERE TIME_CODE = 150 GROUP BY AGE_CODE) AS
    SLEEP_TIME_150 ON
    SLEEP_TIME_150.AGE_CODE = AGE_GRP.AGE_CODE
INNER JOIN
    (SELECT AGE_CODE, SUM(TARGET_POP) AS TARGET_POP FROM SLEEP_TIME_DTL WHERE TIME_CODE = 160 GROUP BY AGE_CODE) AS
    SLEEP_TIME_160 ON
    SLEEP_TIME_160.AGE_CODE = AGE_GRP.AGE_CODE
INNER JOIN
    (SELECT AGE_CODE, SUM(TARGET_POP) AS TARGET_POP FROM SLEEP_TIME_DTL WHERE TIME_CODE = 170 GROUP BY AGE_CODE) AS
    SLEEP_TIME_170 ON
    SLEEP_TIME_170.AGE_CODE = AGE_GRP.AGE_CODE
INNER JOIN
    (SELECT AGE_CODE, SUM(TARGET_POP) AS TARGET_POP FROM SLEEP_TIME_DTL WHERE TIME_CODE = 180 GROUP BY AGE_CODE) AS
    SLEEP_TIME_180 ON
    SLEEP_TIME_180.AGE_CODE = AGE_GRP.AGE_CODE
GROUP BY
    AGE_GRP.AGE_CODE
ORDER BY
    AGE_GRP.AGE_CODE
提出情報
提出日時2022/07/20 20:07:08
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者naoigcat
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量103 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
103 MB
データパターン2
AC
100 MB