ソースコード
WITH basedata AS (
	SELECT
		USER_ID
		,POINT
	FROM TEST_RESULTS
	WHERE TEST_ID = '100'
)
,heikinsamade AS (
	SELECT
		t1.USER_ID
		,t1.POINT
		,t2.avgpt
	FROM basedata AS t1
	CROSS JOIN
		(SELECT
			AVG(POINT) AS avgpt
		FROM basedata
		) AS t2
)
,jijo AS (
	SELECT
		USER_ID
		,(POINT - avgpt)*(POINT - avgpt) AS jijo
	FROM heikinsamade
)
,bunsanavg AS (
	SELECT
		AVG(jijo) AS bunavg
	FROM jijo
)
,DEVIATION AS (
	SELECT
		SQRT(bunavg) AS stdev
	FROM bunsanavg
)
SELECT
	t1.USER_ID AS USER
	,t1.POINT AS PT
	,CASE WHEN t2.stdev <> 0 THEN
		ROUND(((t1.POINT - t1.avgpt) * 10)/SQRT(t2.stdev),1) + 50
	END AS DEV_VAL
FROM heikinsamade AS t1
CROSS JOIN DEVIATION AS t2
ORDER BY DEV_VAL DESC ,USER ASC
提出情報
提出日時2023/02/20 20:53:57
コンテスト第5回 SQLコンテスト
問題偏差値の算出
受験者katsu
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量79 MB
メッセージ
テストケース(通過数/総数)
0/4
状態
メモリ使用量
データパターン1
WA
79 MB
データパターン2
WA
78 MB
データパターン3
WA
79 MB
データパターン4
WA
79 MB