**SQL Server Functions**

In database systems in general and in SQL Server in particular, functions are pieces of code that take zero or one input and return a single output or an array.

Table-Valued Functions which are typically user-defined can return an array, but in-built SQL Server functions are typically Scalar-Valued Functions. The third class of functions in SQL Server are Aggregate-Valued Functions. The MIN and MAX SQL Server functions are Aggregate-Valued Functions.

Window Functions are a relatively new class. They perform calculations like aggregate functions but do it over a set of rows related to the current row. While an aggregate function is likely to yield a single result by working on a column, a Window Function is more likely to yield a result for each row.

The SQL Server Functions classification can also ground on data type – String Functions, Numeric Functions, and Date Functions. We can deduce that String Functions operate on string values, e.g., LENGTH().

#sql server #sql functions #sql