ソースコード
select
    USER_ID as USER,
    POINT as PT,
    (
        (POINT - avg.avg) * 10 / (sqrt(avg(power(avg.avg, 2))))
    ) + 50 as DEV_VAL
from
    TEST_RESULTS
    inner join(
        select
            avg(POINT) as avg
        from
            TEST_RESULTS
        where
            TEST_ID = '100'
    ) as avg
where
    TEST_ID = '100'
order by
    DEV_VAL desc,
    USER_ID;

select
    USER_ID as USER,
    POINT as PT,
    case
        when hyoujyunhensa <> 0 then ROUND(
            (
                POINT - (
                    SELECT
                        AVG(POINT)
                    FROM
                        TEST_RESULTS
                    where
                        TEST_ID = '100'
                )
            ) * 10 / hyoujyunhensa + 50,
            1
        )
        else 50.0
    end as DEV_VAL
from
    TEST_RESULTS
    inner join(
        select
            sqrt(AVG(POWER)) as hyoujyunhensa
        from
            (
                select
                    POWER(
                        POINT - (
                            SELECT
                                AVG(POINT)
                            FROM
                                TEST_RESULTS
                            where
                                TEST_ID = '100'
                        ),
                        2
                    ) as POWER
                from
                    TEST_RESULTS
                where
                    TEST_ID = '100'
            )
    ) as hyoujyunhensa
where
    TEST_ID = '100'
order by
    DEV_VAL desc,
    USER_ID
提出情報
提出日時2023/02/20 08:18:07
コンテスト第5回 SQLコンテスト
問題偏差値の算出
受験者taka22
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量79 MB
メッセージ
テストケース(通過数/総数)
4/4
状態
メモリ使用量
データパターン1
AC
78 MB
データパターン2
AC
79 MB
データパターン3
AC
79 MB
データパターン4
AC
78 MB