SQL Functions
SQL has a number of functions to assist you in your database programming.
Functions are a self contained script/program built for a specific purpose. Generally, the value returned by a function will depend on the context in which it is being used. Often, a SQL function will be used within a query and this is what provides it with it's context.
Transact-SQL provides 3 different types of functions:
| Rowset Functions | These return an object that can be used in place of a table reference in a SQL statement |
|---|---|
| Aggregate Functions |
Perform a calculation on a set of values and return a single value. Aggregate functions can be used in the following:
|
| Scalar Functions |
These return a single value from a single value. Scalar functions are categorized as follows:
|
On top of these functions, different database vendors have their own built-in functions for their products. Also, most products enable programmers to program their own User Defined Functions. For information on proprietary functions, you should consult the vendor's documentation.
In the next lesson you will learn about one of the more commonly used SQL functions - the COUNT function.
