ソースコード
SELECT
    AGE_NAME AS 年齢階層,
    SUM(CASE WHEN TIME_NAME = "5時間未満" THEN AMT ELSE 0 END) AS "5時間未満",
    SUM(CASE WHEN TIME_NAME = "5時間以上6時間未満" THEN AMT ELSE 0 END) AS "5時間以上6時間未満",
    SUM(CASE WHEN TIME_NAME = "6時間以上7時間未満" THEN AMT ELSE 0 END) AS "6時間以上7時間未満",
    SUM(CASE WHEN TIME_NAME = "7時間以上8時間未満" THEN AMT ELSE 0 END) AS "7時間以上8時間未満",
    SUM(CASE WHEN TIME_NAME = "8時間以上9時間未満" THEN AMT ELSE 0 END) AS "8時間以上9時間未満",
    SUM(CASE WHEN TIME_NAME = "9時間以上" THEN AMT ELSE 0 END) AS "9時間以上",
    SUM(CASE WHEN TIME_NAME = "不詳" THEN AMT ELSE 0 END) AS "不詳"
FROM(
    SELECT
        B2.AGE_NAME,
        A2.TIME_NAME,
        A2.AMT
    FROM
        (SELECT
            A1.AGE_CODE,
            B1.TIME_NAME,
            A1.TARGET_POP AS AMT
        FROM SLEEP_TIME_DTL AS A1 JOIN SLEEP_TIME AS B1 ON A1.TIME_CODE = B1.TIME_CODE) AS A2
        LEFT JOIN AGE_GRP AS B2 ON A2.AGE_CODE = B2.AGE_CODE
    )
GROUP BY AGE_NAME
提出情報
提出日時2022/08/24 18:41:37
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者tmg_dayo
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量78 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
78 MB
データパターン2
AC
76 MB