O'Reilly logo

Managing & Using MySQL, 2nd Edition by Hugh E. Williams, Randy Yarger, George Reese, Tim King

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

General Functions

General functions operate on one or more discrete values. We have omitted a few rarely used functions with very specialized applications.

ABS( number )

Returns the absolute value of number (e.g., ABS(-10) returns 10).

ACOS( number )

Returns the inverse cosine of number in radians (e.g., ACOS(0) returns 1.570796).

ADDDATE( date, INTERVAL amount type )

Synonym for DATE_ADD.

ASCII( char )

Returns the ASCII value of the given character (e.g., ASCII('h') returns 104).

ASIN( number )

Returns the inverse sine of number in radians (e.g., ASIN(0) returns 0.000000).

ATAN( number )

Returns the inverse tangent of number in radians (e.g., ATAN(1) returns 0.785398).

ATAN2( X, Y )

Returns the inverse tangent of the point ( X , Y ) (for example, ATAN(-3,3) returns -0.785398).

BENCHMARK( num , function )

Runs function over and over num times and reports the total elapsed clock time.

BIN( decimal )

Returns the binary value of the given decimal number (e.g., BIN(8) returns 1000). This is equivalent to the function CONV(decimal,10,2) .

BIT_COUNT( number )

Returns the number of bits that are set to 1 in the binary representation of the number (e.g., BIT_COUNT(17) returns 2).

BIT_LENGTH( string )

Returns the number of bits in string (the number of characters times 8, for single-byte characters).

CASE value WHEN choice THEN returnvalue ... ELSE returnvalue END

Compares value to a series of choice values or expressions. The first choice to match the value ends ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required