Aggregates

Script to calculate the Median value for SQL Server data

  • Article

The standard SQL language has a number of aggregate functions like: SUM, MIN, MAX, AVG, but a common statistics function that SQL Server does not have is a built-in aggregate function for median. The median is the value that falls in the middle of a sorted resultset with equal parts that are smaller and equal parts that are greater. Since there is no built-in implementation for the median, the following is a simple solution I put together to find the median.

2011-11-08

2,817 reads

Pivoting, Unpivoting and Aggregating

  • Article

We asked Phil Factor to write a nice simple quick-start guide about aggregation, pivoting and un-pivoting techniques. To do so, he takes us all the way from getting the data from a published source, transferring it to SQL Server, un-pivoting it, storing it in a relational table, aggregating it and finally pivoting the data in a variety of ways.

2009-11-18

4,484 reads

Blogs

What you need to know About Azure SQL backup

By

Most of DBA are coming from On-premise Database Servers they know very well How...

Social: Respecting Names

By

This is a non-technical post, and my opinion. If you don’t want to read...

Proud to present at this year’s VMworld 2020 conference

By

I’m thrilled to support and participate in this year’s VMworld 2020 conference, which is...

Read the latest Blogs

Forums

Best SQL Course in 2020

By Ankitdixit

Hello All, I want to learn the SQL course but I want to gain...

SSIS DB migration from one server to other server.

By Srinivas Sista

Summary: We had migrated SSISDB from SQL Server version 11.0.6260 to SQL Server version...

Permission to view SQL jobs in SQL Server 2017

By Srinivas Sista

Hi, I'm using SQL Server 2017, I need to give developers only to view...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers