ソースコード
SELECT
    PREFECTURE.PF_CODE AS "都道府県コード"
    , PREFECTURE.PF_NAME AS "都道府県名"
    , TRANSITION.BEFORE_AMT AS "総人口2015年"
    , TRANSITION.AFTER_AMT AS "総人口2020年"
    , TRANSITION.RATE AS "人口増加率"
FROM
    PREFECTURE
    JOIN
        (
            SELECT
                BEFORE.PF_CODE
                , BEFORE.TOTAL_AMT AS BEFORE_AMT
                , AFTER.TOTAL_AMT AS AFTER_AMT
                , ROUND(AFTER.TOTAL_AMT * 100.0 / BEFORE.TOTAL_AMT) AS RATE
            FROM
                (
                    SELECT
                        PF_CODE, TOTAL_AMT
                    FROM
                        POPU_TRANSITION
                    WHERE
                        SURVEY_YEAR = 2015
                ) AS BEFORE
                JOIN
                (
                    SELECT
                        PF_CODE, TOTAL_AMT
                    FROM
                        POPU_TRANSITION
                    WHERE
                        SURVEY_YEAR = 2020
                ) AS AFTER
                USING (PF_CODE)
            WHERE BEFORE.TOTAL_AMT < AFTER.TOTAL_AMT
        ) AS TRANSITION
        USING (PF_CODE)
ORDER BY
    TRANSITION.RATE DESC
    , PREFECTURE.PF_CODE ASC
提出情報
提出日時2024/06/09 20:23:05
コンテスト練習用コンテスト
問題人口増加率分析
受験者emthrm
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量90 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
90 MB
データパターン2
AC
88 MB