## Calculate Moving Median in SQL

Recently a student asked me how he could calculate a Moving Median.  It’s not as easy as you think, as SQL doesn’t

Calculate Moving Median in SQL

## Use SQL to Find the MEDIAN

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

Use SQL to Find the MEDIAN

## SQL SUM Function

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

SQL SUM Function

## SQL Data Conversions

Table of contentsImplicit data conversionExplicit Type Conversions with CAST AND CONVERTCASTCONVERTCONVERT DATETIME TYPESSummaryRelated SQL Conversion Function Posts Implicit data conversion Implicit conversions

SQL Data Conversions

## SQL LOWER Function (Transact SQL)

The SQL LOWER function converts the input character data to a lower case. Description The LOWER function takes character expression as an

SQL LOWER Function (Transact SQL)

## SQL YEAR Function (Transact SQL)

The SQL YEAR function evaluates the input date and returns the year part as an integer.Description The YEAR function works the same

SQL YEAR Function (Transact SQL)

## SQL CEILING Function (Transact SQL)

The SQL CEILING function returns the smallest integer value greater than or equal to the input value. Description The CEILING function evaluates

SQL CEILING Function (Transact SQL)

## Replace Missing Values in your Queries using ISNULL

When working with NULL, you’ll often find yourself wanting to replace these “missing” values, with something else. Just use ISNULL to do

Replace Missing Values in your Queries using ISNULL

## SQL UPPER Function (Transact SQL)

The SQL UPPER function converts the input character expression to an upper case and returns it. Description The UPPER function reads the

SQL UPPER Function (Transact SQL)

## SQL FLOOR Function (Transact SQL)

The SQL FLOOR function returns the largest integer that is smaller or equal to the input expression. Description The FLOOR function helps

SQL FLOOR Function (Transact SQL)

## SQL PATINDEX Function (Transact SQL)

The SQL PATINDEX function searches an input expression for a given pattern. It returns the starting index of the first occurrence of

SQL PATINDEX Function (Transact SQL)

## SQL ISNUMERIC Function (Transact SQL)

The SQL ISNUMERIC function checks the input expression for a valid numeric data type. It returns 1 if the input value is

SQL ISNUMERIC Function (Transact SQL)

## SQL RAND Function (Transact SQL)

The SQL RAND function generates a random number between the range of 0 and 1. The number can be greater than equal

SQL RAND Function (Transact SQL)

## SQL DATEPART Function (Transact SQL)

The SQL DATEPART function returns the specified part of the input date. Description The SQL DATEPART function returns an integer value that

SQL DATEPART Function (Transact SQL)

## SQL RTRIM Function (Transact SQL)

The SQL RTRIM function trims all the trailing spaces from the right side of the input character expression. Description The RTRIM function

SQL RTRIM Function (Transact SQL)

## SQL LTRIM Function (Transact SQL)

The SQL LTRIM function removes the leading blank spaces from the input character expression. Description The LTRIM function returns a character expression

SQL LTRIM Function (Transact SQL)

## SQL CHARINDEX Function (Transact SQL)

The SQL CHARINDEX function returns the starting position of a character expression in another character expression. Description The CHARINDEX function helps with

SQL CHARINDEX Function (Transact SQL)

## SQL GETDATE Function (Transact SQL)

The SQL GETDATE function returns the current timestamp of the database as a datetime value. Description The current timestamp derives from the

SQL GETDATE Function (Transact SQL)

## SQL ROUND Function (Transact SQL)

The SQL ROUND function rounds a numeric value up to a specified number of decimal places or precision. Description The SQL ROUND

SQL ROUND Function (Transact SQL)

## SQL NULLIF Function (Transact SQL)

Use the SQL NULLIF function to compare two input expressions and returns NULL if both are equal. Description Like the COALESCE function,

SQL NULLIF Function (Transact SQL)

## SQL ISNULL Function (Transact SQL)

Use the SQL ISNULL function to evaluate the input expression for a NULL value. If it is NULL, then ISNULL replaces it

SQL ISNULL Function (Transact SQL)

## SQL CONVERT Function (Transact SQL)

Use the SQL CONVERT function to change an input expression from one data type into another specified data type. For example, a

SQL CONVERT Function (Transact SQL)

## SQL REPLACE Function (Transact SQL)

SQL REPLACE function evaluates an input string for a specified substring pattern and replaces these substrings with another specified string value. Use

SQL REPLACE Function (Transact SQL)

## SQL DATEADD Function (Transact SQL)

Use SQL DATEADD to add days, weeks, months, or any timespan specified by datepart to a date to get another. The function