MySQL-Supported Functions

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

ACOS( number )

Returns the arc cosine 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
ASCII( text )

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

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

Returns the arc sine 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, 1) -> 1.262619
BENCHMARK( count,expr )

Executes the expression (expr) count times. The result value is always 0. For example:

BENCHMARK(1000000,ATAN2(3.1415, 1))         -> 0
BIN( number )

Returns a string containing the binary value of n, where n is a BIGINT number.

BINARY string

Casts string to a binary string.

BIT_AND( expr )

An aggregate function that returns the bitwise AND of all bits in expr. The calculation is performed with 64-bit (BIGINT) precision. The value of -1 is returned when no matching ...

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.