Skip to Content
SQL in a Nutshell, 4th Edition
book

SQL in a Nutshell, 4th Edition

by Kevin Kline, Regina O. Obe, Leo S. Hsu
June 2022
Intermediate to advanced
838 pages
21h 1m
English
O'Reilly Media, Inc.
Book available
Content preview from SQL in a Nutshell, 4th Edition

Chapter 7. SQL Built-in 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. 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. Functions may also return tables or sets of rows. These types of functions are often referred to as set-returning functions.

The SQL standard supports a number of useful functions. This chapter and the next cover those functions, providing detailed descriptions and examples for each platform. We do not cover every function under the sun, but will focus on the most commonly used functions. In addition, each database supports a large set of its own internal functions that are outside the scope of the SQL standard; listings of these functions for each vendor are provided at the end of each chapter.

In the case of MariaDB and MySQL, we will refer only to MySQL except in cases where MariaDB deviates from MySQL behavior.

Most database platforms support the ability to create user-defined functions (UDFs). For more information on UDFs, refer to Chapter 9. JSON and XML functions are covered in Chapter 10 and will not be discussed in this or the next chapter.

How to Use This Chapter

When researching a function in this chapter:

  1. Check ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Effective SQL: 61 Specific Ways to Write Better SQL, First Edition

Effective SQL: 61 Specific Ways to Write Better SQL, First Edition

John L. Viescas, Douglas J. Steele, Ben G. Clothier
SQL Cookbook, 2nd Edition

SQL Cookbook, 2nd Edition

Anthony Molinaro, Robert de Graaf

Publisher Resources

ISBN: 9781492088851Errata Page