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

Read More
Calculate Moving Median in SQL

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

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

Read More
SQL Data Conversions

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

Read More
SQL LOWER 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

Read More
SQL YEAR 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

Read More
SQL CEILING Function (Transact SQL)

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

Read More
Replace Missing Values in your Queries using ISNULL

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

Read More
SQL UPPER 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

Read More
SQL FLOOR 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

Read More
SQL PATINDEX 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

Read More
SQL ISNUMERIC 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

Read More
SQL RAND 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

Read More
SQL DATEPART 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

Read More
SQL RTRIM 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

Read More
SQL LTRIM 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

Read More
SQL CHARINDEX 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

Read More
SQL GETDATE 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

Read More
SQL ROUND 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,

Read More
SQL NULLIF 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

Read More
SQL ISNULL 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

Read More
SQL CONVERT 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

Read More
SQL REPLACE 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

Read More
SQL DATEADD Function (Transact SQL)

The SQL DATEDIFF function calculates and returns the difference between two date values. The value returned is an integer. You can use

Read More
SQL DATEDIFF Function (Transact SQL)