Skip to Main Content
SQL in a Nutshell, 3rd Edition
book

SQL in a Nutshell, 3rd Edition

by Kevin Kline
November 2008
Intermediate to advanced content levelIntermediate to advanced
591 pages
17h 28m
English
O'Reilly Media, Inc.
Content preview from SQL in a Nutshell, 3rd Edition

MySQL-Supported Functions

This section provides an alphabetical listing of MySQL-supported functions, with examples and corresponding results.

ACOS(number)

Returns the arccosine of number, ranging from −1 to 1. The result ranges from 0 to π and is expressed in radians. For example:

SELECT ACOS( 0 ) -> 1.570796
ADDDATE(date, days)

Returns date with days added to it. For example:

SELECT ADDDATE('2008-05-14', 1) -> '2008-05-15'
ADDDATE(date, INTERVAL expr unit)

Returns date with expr units of unit added. For example:

SELECT ADDDATE('2008-05-14', INTERVAL 1 DAY) -> '2008-05-15'
AES_DECRYPT(crypt_str, key_str)

Returns crypt_str decrypted using AES and the key key_str.

AES_ENCRYPT(str, key_str)

Returns str encrypted with AES using the key key_str. For example:

SELECT AES_DECRYPT(AES_ENCRYPT('secret sauce', 'password'), 'password')
-> 'secret sauce'
ASCII(text)

Returns the ASCII code of the first character of text. For example:

SELECT ASCII('x') -> 120
ASIN(number)

Returns the arcsine of number, ranging from −1 to 1. The resulting value ranges from -π/2 to π/2 and is expressed in radians. For example:

SELECT ASIN( 0 ) -> 0.000000
ATAN(number)

Returns the arctangent of any number. The resulting value ranges from -π/2 to π/2 and is expressed in radians. For example:

SELECT ATAN( 3.1415 ) -> 1.262619
ATAN2(x, y)

Returns the arctangent of the two variables x and y. ATAN2(x, y) is similar to ATAN(y/x), with the exception that the signs of x and y are used to determine the quadrant of the result. For example:

ATAN2(3.1415, ...
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 in a Nutshell, 4th Edition

SQL in a Nutshell, 4th Edition

Kevin Kline, Regina O. Obe, Leo S. Hsu

Publisher Resources

ISBN: 9780596155322Errata Page