# How to calculate median, 2nd standard deviation, min ranga, max range and outlier in sql server 2008RSS

## 2 replies

Last post Apr 02, 2018 08:04 AM by IsaiSelvan

• IsaiSelvan

None

0 Points

4 Posts

### How to calculate median, 2nd standard deviation, min ranga, max range and outlier in sql server 2...

```Here, below sample table for caluculating medain, 2nd standard deviation, min, max and outlier calculation. I'm trying to calculate but its shows wrong value in sql server 2008.

Rat Cat	A     B     C	                      Median	2StandDevi Count  Min Range  Max Range  Outlier
AAA 1	6.5   6.25  2.56                      6.25	4.4122707684
AAA 3	5.25  7.36  3.25                      5.25	4.1104906439
AAA 5	3.25  6.25  4.25                      4.25	3.0550504633
AAA 7	6.25  6.32  6.35                      6.32	0.1026320288
AA  1	7.23  8.52  7.35                      7.35	1.4253420642
AA  3	7.83  7.01  6.52                      7.01	1.3237824595
AA  5	7.2   7.03  4.52                      7.03	3.0012663994
AA  7	7.14  5.03  6.32                      6.32	2.1273771018	```
• Brando ZWZ

Star

7751 Points

2239 Posts

### Re: How to calculate median, 2nd standard deviation, min ranga, max range and outlier in sql serv...

Apr 02, 2018 02:38 AM|Brando ZWZ|LINK

Hi IsaiSelvan,

Welcome to asp.net forum.

This sub forum is talking about the html,css/jquery.

Do you mean you want to calculate the table by using the jquery in the page or the sql query.

If you could post more details information, it will be more easily for us to find the solution.

Best Regards,

Brando

• IsaiSelvan

None

0 Points

4 Posts

### Re: How to calculate median, 2nd standard deviation, min ranga, max range and outlier in sql serv...

How to find the Median, 2 standard deviations, min range , max range in SQL Server 2008?

Actual Table:
=============
+-----+-----+------+-------+------------+
| Rat | Cat | A | B | C |
+-----+-----+------+-------+------------+
| AAA | 1 | 6.5 | 6.25 | 2.56 |
| AAA | 3 | 5.25 | 7.36 | 3.25 |
| AAA | 5 | 3.25 | 6.25 | 4.25 |
| AAA | 7 | 6.25 | 6.32 | 6.35 |
| AA | 1 | 7.23 | 8.52 | 7.35 |
| AA | 3 | 7.83 | 7.01 | 6.52 |
| AA | 5 | 7.2 | 7.03 | 4.52 |
| AA | 7 | 7.14 | 5.03 | 6.32 |
+-----+-----+------+-------+------------+

Expected Result:
================
--------+-------------+-------+-----+-------------+
Median | 2StanddDevi | Count | Min | Max Outlier |
--------+-------------+-------+-----+-------------+
6.25 | 4.412270768 | | | |
5.25 | 4.110490644 | | | |
4.25 | 3.055050463 | | | |
6.32 | 0.102632029 | | | |
7.35 | 1.425342064 | | | |
7.01 | 1.32378246 | | | |
7.03 | 3.001266399 | | | |
6.32 | 2.127377102 | | | |
--------+-------------+-------+-----+-------------+