质量分析与评价系统 指标计算示例

-- 质量分析与评价系统 指标计算示例
 
    SELECT 
      T.SCORE  原始分
     ,RANK() OVER ( ORDER BY T.SCORE DESC) 排名
     ,(NVL(UP_NUMBER, 0)-1) * 1.0 / CNT * 100 "百分等级%"
     ,ROUND((T.SCORE - AVG(T.SCORE) OVER()) / STDDEV_POP(T.SCORE) OVER(),2)  Z标准分    
     ,50 + 10 * ROUND((T.SCORE - AVG(T.SCORE) OVER()) / STDDEV_POP(T.SCORE) OVER(),0) T分数
     ,AVG(T.SCORE) OVER() 平均分
     ,AVG(T.SCORE) OVER() / 100 * 100 "平均分得分率%"
     ,T.SCORE - AVG(T.SCORE) OVER() 离均差
     ,ROUND((T.SCORE - AVG(T.SCORE) OVER()) / AVG(T.SCORE) OVER() * 100,2) "离均差率%"
     ,(T.SCORE - AVG(T.SCORE) OVER()) / 100 * 100 "偏科幅度%"
     ,ROUND(STDDEV(T.SCORE) OVER(),2)      样本标准差
     ,ROUND(STDDEV_POP(T.SCORE) OVER(),2)  总体标准差
     ,ROUND(STDDEV_POP(T.SCORE) OVER() / AVG(T.SCORE) OVER() * 100,2) "差异系数%"
     ,MAX(T.SCORE) OVER() 最高分
     ,MIN(T.SCORE) OVER() 最低分
     ,SUM(CASE WHEN UP_NUMBER = ROUND(CNT*1/4,0) THEN T.SCORE ELSE 0 END) OVER()  Q1          -- 第一四分位数
     ,SUM(CASE WHEN UP_NUMBER IN ((CNT + 1) / 2,(CNT + 2) / 2) THEN T.SCORE ELSE 0 END) OVER() 
       /SUM(CASE WHEN UP_NUMBER IN((CNT + 1) / 2,(CNT + 2) / 2) THEN 1 ELSE 0 END) OVER() Q2  -- 中位数
     ,SUM(CASE WHEN UP_NUMBER = ROUND(CNT*3/4,0) THEN T.SCORE ELSE 0 END) OVER()  Q3          -- 第三四分位数
     ,MAX(T.SCORE) OVER() - MIN(T.SCORE) OVER() 极差
     ,SUM(CASE WHEN UP_NUMBER = ROUND(CNT*3/4,0) THEN T.SCORE ELSE 0 END) OVER() 
     - SUM(CASE WHEN UP_NUMBER = ROUND(CNT*1/4,0) THEN T.SCORE ELSE 0 END) OVER() IQR         -- 四分位距    
     FROM    
    ( 
        SELECT M.SCORE
         ,ROW_NUMBER() OVER(ORDER BY M.SCORE ASC) UP_NUMBER
         ,COUNT(1) OVER() CNT
         FROM    
            ( 
              SELECT 78 SCORE FROM DUAL 
              UNION ALL
              SELECT 84 FROM DUAL
              UNION ALL
              SELECT 90 FROM DUAL
              UNION ALL
              SELECT 89 FROM DUAL
              UNION ALL
              SELECT 92 FROM DUAL
            ) M
    ) T 

你可能感兴趣的:(质量分析与评价系统 指标计算示例)