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 that 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. However, many functions do not use any type of input parameter. The function that returns the current system time, CURRENT_TIME, is an example of such a function.

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 its own internal functions that are outside the scope of the standard SQL. This chapter provides parameters and descriptions for each database implementation’s internal functions.

Tip

Most database platforms also support the ability to create user-defined functions (UDFs). For more information on UDFs, refer to Chapter 3.

Get SQL in a Nutshell, 3rd 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.