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 overnum
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 functionCONV(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 singlebyte characters).
CASE
value
WHEN
choice
THEN
returnvalue
... ELSE
returnvalue
END
Compares
value
to a series ofchoice
values or expressions. The firstchoice
to match thevalue
ends ...
Get Managing & Using MySQL, 2nd Edition now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.