ソースコード
SELECT
    age.age_name AS 年齢階層,
    SUM(
        CASE time.time_code
        WHEN 120 THEN pop.target_pop
        ELSE NULL
        END
    ) AS `5時間未満`,
    SUM(
        CASE time.time_code
        WHEN 130 THEN pop.target_pop
        ELSE NULL
        END
    ) AS `5時間以上6時間未満`,
    SUM(
        CASE time.time_code
        WHEN 140 THEN pop.target_pop
        ELSE NULL
        END
    ) AS `6時間以上7時間未満`,
    SUM(
        CASE time.time_code
        WHEN 150 THEN pop.target_pop
        ELSE NULL
        END
    ) AS `7時間以上8時間未満`,
    SUM(
        CASE time.time_code
        WHEN 160 THEN pop.target_pop
        ELSE NULL
        END
    ) AS `8時間以上9時間未満`,
    SUM(
        CASE time.time_code
        WHEN 170 THEN pop.target_pop
        ELSE NULL
        END
    ) AS `9時間以上`,
    SUM(
        CASE time.time_code
        WHEN 180 THEN pop.target_pop
        ELSE NULL
        END
    ) AS 不詳
FROM age_grp AS age
JOIN sleep_time_dtl AS pop
ON age.age_code = pop.age_code
JOIN sleep_time AS time
ON pop.time_code = time.time_code
GROUP BY age.age_code
ORDER BY age.age_code;
提出情報
提出日時2022/07/10 19:41:39
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者arlechann
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量86 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
86 MB
データパターン2
AC
77 MB