SQL Server 下取中位数(中位值)的方法
Jun 07, 2016 pm 05:20 PM将数据排序后,位置在最中间的数值。即将数据分成两部分,一部分大于该数值,一部分小于该数值。中位数的位置:当样本数为奇数时
中位数是指将数据按大小顺序排列起来,形成一个数列,居于数列中间位置的那个数据。中位数用Me表示。
从中位数的定义可知,所研究的数据中有一半小于中位数,一半大于中位数。中位数的作用与算术平均数相近,也是作为所研究数据的代表值。在一个等差数列或一个正态分布数列中,中位数就等于算术平均数。
在数列中出现了极端变量值的情况下,用中位数作为代表值要比用算术平均数更好,因为中位数不受极端变量值的影响;如果研究目的就是为了反映中间水平,当然也应该用中位数。在统计数据的处理和分析时,可结合使用中位数。
将数据排序后,位置在最中间的数值。即将数据分成两部分,一部分大于该数值,一部分小于该数值。中位数的位置:当样本数为奇数时,中位数=(N+1)/2 ; 当样本数为偶数时,中位数为N/2与1+N/2的均值 ,,或求出中间两个数的平均数作为中位数。
在Excel中有函数MEDIAN来取中位数,但是在SQL Server中则没有该内置的函数,需要用以下方法求得。

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

What software is microsoft sql server?

PHP and SQL Server database development

SQL Server or MySQL? New research reveals the best database choices.

How to connect to a Microsoft SQL Server database using PDO

SQL Server and MySQL compete, how to choose the best database solution?

A brief analysis of five methods of connecting SQL Server with PHP

SQL Server vs. MySQL: Which database is more suitable for high availability architecture?

SQL Server vs. MySQL comparison: Which one is better for large-scale data processing?
