ソースコード
SELECT
    AG.AGE_NAME '年齢階層',
    STD_120.TARGET_POP '5時間未満',
    STD_130.TARGET_POP '5時間以上6時間未満',
    STD_140.TARGET_POP '6時間以上7時間未満',
    STD_150.TARGET_POP '7時間以上8時間未満',
    STD_160.TARGET_POP '8時間以上9時間未満',
    STD_170.TARGET_POP '9時間以上',
    STD_180.TARGET_POP '不詳'
FROM AGE_GRP AG
    INNER JOIN (
        SELECT
            STD.AGE_CODE,
            SUM(STD.TARGET_POP) TARGET_POP,
            ST.TIME_NAME
        FROM
            SLEEP_TIME_DTL STD
            INNER JOIN SLEEP_TIME ST ON STD.TIME_CODE=ST.TIME_CODE
        WHERE STD.TIME_CODE=120
        GROUP BY STD.AGE_CODE
    ) STD_120 ON STD_120.AGE_CODE = AG.AGE_CODE
    INNER JOIN (
        SELECT
            STD.AGE_CODE,
            SUM(STD.TARGET_POP) TARGET_POP,
            ST.TIME_NAME
        FROM
            SLEEP_TIME_DTL STD
            INNER JOIN SLEEP_TIME ST ON STD.TIME_CODE=ST.TIME_CODE
        WHERE STD.TIME_CODE=130
        GROUP BY STD.AGE_CODE
    ) STD_130 ON STD_130.AGE_CODE = AG.AGE_CODE
    INNER JOIN (
        SELECT
            STD.AGE_CODE,
            SUM(STD.TARGET_POP) TARGET_POP,
            ST.TIME_NAME
        FROM
            SLEEP_TIME_DTL STD
            INNER JOIN SLEEP_TIME ST ON STD.TIME_CODE=ST.TIME_CODE
        WHERE STD.TIME_CODE=140
        GROUP BY STD.AGE_CODE
    ) STD_140 ON STD_140.AGE_CODE = AG.AGE_CODE
    INNER JOIN (
        SELECT
            STD.AGE_CODE,
            SUM(STD.TARGET_POP) TARGET_POP,
            ST.TIME_NAME
        FROM
            SLEEP_TIME_DTL STD
            INNER JOIN SLEEP_TIME ST ON STD.TIME_CODE=ST.TIME_CODE
        WHERE STD.TIME_CODE=150
        GROUP BY STD.AGE_CODE
    ) STD_150 ON STD_150.AGE_CODE = AG.AGE_CODE
    INNER JOIN (
        SELECT
            STD.AGE_CODE,
            SUM(STD.TARGET_POP) TARGET_POP,
            ST.TIME_NAME
        FROM
            SLEEP_TIME_DTL STD
            INNER JOIN SLEEP_TIME ST ON STD.TIME_CODE=ST.TIME_CODE
        WHERE STD.TIME_CODE=160
        GROUP BY STD.AGE_CODE
    ) STD_160 ON STD_160.AGE_CODE = AG.AGE_CODE
    INNER JOIN (
        SELECT
            STD.AGE_CODE,
            SUM(STD.TARGET_POP) TARGET_POP,
            ST.TIME_NAME
        FROM
            SLEEP_TIME_DTL STD
            INNER JOIN SLEEP_TIME ST ON STD.TIME_CODE=ST.TIME_CODE
        WHERE STD.TIME_CODE=170
        GROUP BY STD.AGE_CODE
    ) STD_170 ON STD_170.AGE_CODE = AG.AGE_CODE
    INNER JOIN (
        SELECT
            STD.AGE_CODE,
            SUM(STD.TARGET_POP) TARGET_POP,
            ST.TIME_NAME
        FROM
            SLEEP_TIME_DTL STD
            INNER JOIN SLEEP_TIME ST ON STD.TIME_CODE=ST.TIME_CODE
        WHERE STD.TIME_CODE=180
        GROUP BY STD.AGE_CODE
    ) STD_180 ON STD_180.AGE_CODE = AG.AGE_CODE
    
ORDER BY  AG.AGE_CODE ASC
提出情報
提出日時2023/08/27 03:12:10
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者fractal1024
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量80 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
80 MB
データパターン2
AC
78 MB