ソースコード
SELECT
    AG.AGE_CODE AS "年齢コード",
    AG.AGE_NAME AS "年齢階層名",
    SUM(CASE WHEN STD.PF_CODE IN ('01000','02000','03000','04000','07000') THEN STD.SP_TIME_5 ELSE 0 END) AS "5時間未満",
    SUM(CASE WHEN STD.PF_CODE IN ('01000','02000','03000','04000','07000') THEN STD.SP_TIME_6 ELSE 0 END) AS "5時間以上6時間未満",
    SUM(CASE WHEN STD.PF_CODE IN ('01000','02000','03000','04000','07000') THEN STD.SP_TIME_7 ELSE 0 END) AS "6時間以上7時間未満",
    SUM(CASE WHEN STD.PF_CODE IN ('01000','02000','03000','04000','07000') THEN STD.SP_TIME_8 ELSE 0 END) AS "7時間以上8時間未満",
    SUM(CASE WHEN STD.PF_CODE IN ('01000','02000','03000','04000','07000') THEN STD.SP_TIME_9 ELSE 0 END) AS "8時間以上9時間未満",
    SUM(CASE WHEN STD.PF_CODE IN ('01000','02000','03000','04000','07000') THEN STD.SP_TIME_9OVER ELSE 0 END) AS "9時間以上"
FROM
    SLEEP_TIME_DTL AS STD
    INNER JOIN
    PREFECTURE AS P
    ON STD.PF_CODE = P.PF_CODE
    INNER JOIN
    AGE_GRP AS AG
    ON STD.AGE_CODE = AG.AGE_CODE
GROUP BY
    STD.AGE_CODE
;
提出情報
提出日時2023/07/12 13:54:18
コンテスト第1回 SQLコンテスト
問題睡眠時間帯別集計
受験者roborobo
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量78 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
78 MB
データパターン2
AC
78 MB