ソースコード
WITH AVG as (
 SELECT AVG(POINT) AS avg FROM TEST_RESULTS WHERE TEST_ID = '100'
), DIFF as (
 SELECT point - avg AS diff FROM TEST_RESULTS LEFT OUTER JOIN AVG WHERE TEST_ID = '100'
), VARIANCE as (
 SELECT AVG(POW(diff, 2)) as variance FROM DIFF
), SIGMA as(
 SELECT SQRT(variance) AS sigma FROM VARIANCE
)
 
SELECT
result.USER_ID AS USER,
result.POINT AS PT,
CASE
 WHEN ROUND((result.point - avg) * 10 / sigma + 50, 1) = 0 THEN 50
 ELSE ROUND((result.point - avg) * 10 / sigma + 50, 1) 
END AS DEV_VAL
FROM TEST_RESULTS result
LEFT OUTER JOIN AVG
LEFT OUTER JOIN SIGMA
WHERE TEST_ID = '100'
ORDER BY DEV_VAL DESC, result.USER_ID ASC;
提出情報
提出日時2023/02/18 15:02:48
コンテスト第5回 SQLコンテスト
問題偏差値の算出
受験者daisuzz
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量76 MB
メッセージ
テストケース(通過数/総数)
3/4
状態
メモリ使用量
データパターン1
AC
76 MB
データパターン2
WA
76 MB
データパターン3
AC
76 MB
データパターン4
AC
76 MB