Problem You need use SQL to calculate the Median of a result from SQL Server. Background Suppose you need to calculate the

Read More
Use SQL to Find the MEDIAN

The SQL SUM function returns the total value within a table or group. In its simplest use, SUM() totals a column for all results and returns a

Read More
SQL SUM Function

The SQL COUNT function is an aggregate function used to count rows.  Use it alone within a SELECT statement to return a count of all rows within

Read More
SQL COUNT Function

Use the Approximate Count Distinct function, APPROX_COUNT_DISTINCT, to return an estimate distinct count of values withing rows. It is best suited for

Read More
SQL APPROX_COUNT_DISTINCT Function

The SQL MIN function returns the smallest value within a table or group.  Throughout this section we’ll use the HumanResource.Employee table for our examples:  Using the

Read More
SQL MIN Function

The SQL MAX function returns the largest value within a table or group. In this section, we’ll use the HumanResource.Employee table for our examples:  Using the data above, MAX calculates

Read More
SQL MAX Function

The SQL AVG function returns the average value within a table or group. In this section, we’ll use the HumanResource.Employee table for our examples: Using sample data above, AVG calculates

Read More
SQL AVG Function