Chapter 4: SQL Language Elements
4.9 Functions
Functions are a type of SQL expression that return a value based on the argument they are supplied. SQL supports two types of functions:
- Aggregate functions calculate a single value for a collection of rows in a result table (if the function is in a statement with a GROUP BY clause, it returns a value for each group in the result table). Aggregate functions are also called set or statistical functions. Aggregate functions cannot be nested.
- Scalar functions calculate a value based on another single value. Scalar functions are also called value functions. Scalar functions can be nested.