ソースコード
WITH T1 AS(
SELECT
    AGE_CODE,
    SUM(TARGET_POP) AS TOTAL
FROM
    SLEEP_TIME_DTL
WHERE TIME_CODE = 120
GROUP BY 1
),T2 AS(
SELECT
    AGE_CODE,
    SUM(TARGET_POP) AS TOTAL
FROM
    SLEEP_TIME_DTL
WHERE TIME_CODE = 130
GROUP BY 1
), T3 AS(
SELECT
    AGE_CODE,
    SUM(TARGET_POP) AS TOTAL
FROM
    SLEEP_TIME_DTL
WHERE TIME_CODE = 140
GROUP BY 1
), T4 AS(
SELECT
    AGE_CODE,
    SUM(TARGET_POP) AS TOTAL
FROM
    SLEEP_TIME_DTL
WHERE TIME_CODE = 150
GROUP BY 1
), T5 AS(
SELECT
    AGE_CODE,
    SUM(TARGET_POP) AS TOTAL
FROM
    SLEEP_TIME_DTL
WHERE TIME_CODE = 160
GROUP BY 1
), T6 AS(
SELECT
    AGE_CODE,
    SUM(TARGET_POP) AS TOTAL
FROM
    SLEEP_TIME_DTL
WHERE TIME_CODE = 170
GROUP BY 1
), T7 AS(
SELECT
    AGE_CODE,
    SUM(TARGET_POP) AS TOTAL
FROM
    SLEEP_TIME_DTL
WHERE TIME_CODE = 180
GROUP BY 1
)
SELECT 
    A.AGE_NAME AS "年齢階層",
    T1.TOTAL AS "5時間未満",
    T2.TOTAL AS "5時間以上6時間未満",
    T3.TOTAL AS "6時間以上7時間未満",
    T4.TOTAL AS "7時間以上8時間未満",
    T5.TOTAL AS "8時間以上9時間未満",
    T6.TOTAL AS "9時間以上",
    T7.TOTAL AS "不詳"
from T1
INNER JOIN T2 ON T1.AGE_CODE = T2.AGE_CODE
INNER JOIN T3 ON T1.AGE_CODE = T3.AGE_CODE
INNER JOIN T4 ON T1.AGE_CODE = T4.AGE_CODE
INNER JOIN T5 ON T1.AGE_CODE = T5.AGE_CODE
INNER JOIN T6 ON T1.AGE_CODE = T6.AGE_CODE
INNER JOIN T7 ON T1.AGE_CODE = T7.AGE_CODE
INNER JOIN AGE_GRP A ON A.AGE_CODE = T1.AGE_CODE
;
提出情報
提出日時2022/07/11 16:46:44
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者katayaaaaaaman
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量88 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
88 MB
データパターン2
AC
87 MB