ソースコード
SELECT
    T.USER_ID AS USER,
    POINT AS PT,
    ROUND(C.DEV, 1) AS DEV_VAL
FROM
    (
        SELECT *
        FROM
            TEST_RESULTS
        WHERE
            TEST_ID = '100'
    ) AS T
INNER JOIN
    (
    SELECT
        TEST_DATA.USER_ID,
        CASE 
            WHEN CAL_DATA.HENSA = 0
                THEN
                50.0
            ELSE
                ((TEST_DATA.POINT - CAL_DATA.AV) / CAL_DATA.HENSA * 10.0 + 50.0)
        END AS DEV
    FROM
        (
            SELECT *
            FROM
                TEST_RESULTS
            WHERE
                TEST_ID = '100'
        ) AS TEST_DATA,
        (
        SELECT
            SQRT(AVG(
                POW(TES.POINT - CAL.AV, 2)
            )) AS HENSA,
            CAL.AV
        FROM
            (
                SELECT *
                FROM
                    TEST_RESULTS
                WHERE
                    TEST_ID = '100'
            ) AS TES,
            (
                SELECT
                    AVG(TE.POINT) AS AV
                FROM
                (
                    SELECT *
                    FROM
                        TEST_RESULTS
                    WHERE
                        TEST_ID = '100'
                ) AS TE
            ) AS CAL
        ) AS CAL_DATA
    ) AS C
ON
    T.USER_ID = C.USER_ID
ORDER BY
    DEV_VAL DESC,
    T.USER_ID ASC
提出情報
提出日時2023/02/17 17:13:15
コンテスト第5回 SQLコンテスト
問題偏差値の算出
受験者nadia
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量87 MB
メッセージ
テストケース(通過数/総数)
4/4
状態
メモリ使用量
データパターン1
AC
83 MB
データパターン2
AC
87 MB
データパターン3
AC
84 MB
データパターン4
AC
86 MB