Chapter 4. SQL Functions

A function is a special type of command word in the SQL command set, and each SQL dialect varies in its implementation of the command set. In effect, functions are one-word commands that return single values. The value of a function can be determined by input parameters, as with a function that averages a list of database values. But many functions do not use any type of input parameter, such as the function that returns the current system time, CURRENT_TIME.

The ANSI standard supports a number of useful functions. This chapter covers those functions, providing detailed descriptions and examples for each platform. In addition, each database maintains a long list of their own internal functions that are outside of the scope of the standard SQL. This chapter provides parameters and descriptions for each database implementation’s internal functions.

In addition, most database platforms support the ability to create user-defined functions (UDFs). For more information on UDFs, refer to the CREATE/ALTER FUNCTION/PROCEDURE Statements.

Get SQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.