ソースコード
SELECT
    AGE.AGE_NAME AS '年齢階層'
    ,S120.TARGET_POP120 AS '5時間未満'
    ,S130.TARGET_POP130 AS '5時間以上6時間未満'
    ,S140.TARGET_POP140 AS '6時間以上7時間未満'
    ,S150.TARGET_POP150 AS '7時間以上8時間未満'
    ,S160.TARGET_POP160 AS '8時間以上9時間未満'
    ,S170.TARGET_POP170 AS '9時間以上'
    ,S180.TARGET_POP180 AS '不詳'
FROM AGE_GRP AGE
INNER JOIN
(
    SELECT
        DTL.AGE_CODE
        ,DTL.TIME_CODE
        ,SUM(TARGET_POP) AS TARGET_POP120
    FROM SLEEP_TIME_DTL DTL
    WHERE DTL.TIME_CODE = 120
    GROUP BY DTL.AGE_CODE
) S120
ON S120.AGE_CODE = AGE.AGE_CODE
INNER JOIN
(
    SELECT
        DTL.AGE_CODE
        ,DTL.TIME_CODE
        ,SUM(TARGET_POP) AS TARGET_POP130
    FROM SLEEP_TIME_DTL DTL
    WHERE DTL.TIME_CODE = 130
    GROUP BY DTL.AGE_CODE
) S130
ON S130.AGE_CODE = AGE.AGE_CODE
INNER JOIN
(
    SELECT
        DTL.AGE_CODE
        ,DTL.TIME_CODE
        ,SUM(TARGET_POP) AS TARGET_POP140
    FROM SLEEP_TIME_DTL DTL
    WHERE DTL.TIME_CODE = 140
    GROUP BY DTL.AGE_CODE
) S140
ON S140.AGE_CODE = AGE.AGE_CODE
INNER JOIN
(
    SELECT
        DTL.AGE_CODE
        ,DTL.TIME_CODE
        ,SUM(TARGET_POP) AS TARGET_POP150
    FROM SLEEP_TIME_DTL DTL
    WHERE DTL.TIME_CODE = 150
    GROUP BY DTL.AGE_CODE
) S150
ON S150.AGE_CODE = AGE.AGE_CODE
INNER JOIN
(
    SELECT
        DTL.AGE_CODE
        ,DTL.TIME_CODE
        ,SUM(TARGET_POP) AS TARGET_POP160
    FROM SLEEP_TIME_DTL DTL
    WHERE DTL.TIME_CODE = 160
    GROUP BY DTL.AGE_CODE
) S160
ON S160.AGE_CODE = AGE.AGE_CODE
INNER JOIN
(
    SELECT
        DTL.AGE_CODE
        ,DTL.TIME_CODE
        ,SUM(TARGET_POP) AS TARGET_POP170
    FROM SLEEP_TIME_DTL DTL
    WHERE DTL.TIME_CODE = 170
    GROUP BY DTL.AGE_CODE
) S170
ON S170.AGE_CODE = AGE.AGE_CODE
INNER JOIN
(
    SELECT
        DTL.AGE_CODE
        ,DTL.TIME_CODE
        ,SUM(TARGET_POP) AS TARGET_POP180
    FROM SLEEP_TIME_DTL DTL
    WHERE DTL.TIME_CODE = 180
    GROUP BY DTL.AGE_CODE
) S180
ON S180.AGE_CODE = AGE.AGE_CODE
提出情報
提出日時2024/06/02 17:07:01
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者pumpkin2024
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
85 MB
データパターン2
AC
85 MB