Microsoft Word - Sam's Teach Yourself MySQL in 21 Days - SAMS.doc

(singke) #1
Example:
SELECT BIN(3)
Result:

"11"

CEILING(x)


Returns the smallest integer value that is not less than x. The return value is converted to a BIGINT. See
FLOOR().
Example:
SELECT CEILING(4.56)
Result:


4
Example:
SELECT CEILING(-4.56)
Result:

-4

CHAR(x, y, z ...)


Returns a string of values based on the ASCII code values of the arguments provided. NULL values are
skipped.
Example:
SELECT CHAR(65, 78, 87, 100)
Result:


ANWd

CHARACTER_LENGTH, CHAR_LENGTH


See LENGTH().


COALESCE(expression1, expression2)


Returns the first non-NULL value in the given list of expressions.
Example:
SELECT COALESCE(NULL, 345, 56)
Results:


345

CONCAT(x, y, z, ...)


Returns the result of combining the arguments into one string. If a NULL value is used for any of the
arguments, a NULL value will be returned.
Example:
SELECT CONCAT("Sydney", " ", "Renee")
Result:


Sydney Renee
Example:
SELECT CONCAT("SO", NULL, "0987")
Result:
NULL

CONV(x, from base, to base)


Converts a number from one base to another. The return value is a string.
Example:
SELECT CONV(3, 10, 2)
Results:


"11"

COS(x)


Returns the cosine of x where x is in radians.

Free download pdf