ソースコード
with ave as(
select cast(sum(point) as REAL )/cast(count(*) as REAL) as ave, cast(count(*) as REAL) as num from TEST_RESULTS where TEST_ID ='100'
), sabun as(
select *, cast(point as REAL)-(select ave from ave) sabun from TEST_RESULTS where TEST_ID ='100'
), beki as (
select *, sabun*sabun as beki from sabun
), sq as(
select sum(beki), sqrt(sum(beki)/(select num from ave)) as sq from beki
)
select USER_ID as USER, POINT as PT, 
case 
    when  (select sq from sq) <>0
    then round((cast(point as REAL)-(select ave from ave))*10/(select sq from sq) + 50, 1) 
    else 50
    end as DEV_VAL 
from TEST_RESULTS 
where TEST_ID ='100'
order by DEV_VAL desc, USER


提出情報
提出日時2023/02/20 20:31:57
コンテスト第5回 SQLコンテスト
問題偏差値の算出
受験者birt
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量76 MB
メッセージ
テストケース(通過数/総数)
4/4
状態
メモリ使用量
データパターン1
AC
75 MB
データパターン2
AC
76 MB
データパターン3
AC
76 MB
データパターン4
AC
76 MB