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

(singke) #1

REPLACE(x, y, z)


Returns the string x with all occurrences of y replaced with z.
Example:
SELECT REPLACE("The Brown Cow", "The", "A")
Result:


"A Brown Cow"

REVERSE(x)


Returns string x in reverse order.
Example:
SELECT REVERSE("Mark")
Result:


"kraM"

RIGHT(string, length)


Return the rightmost length of characters from string. A NULL will be returned if the string is NULL.
Example:
SELECT RIGHT("Super", 2)
Results:


"er"

ROUND(x)


Returns the argument rounded to the nearest whole number (integer). See ROUND(x,y).
Example:
SELECT ROUND(5.374)
Result:


5
Example:
SELECT ROUND(-5.374)
Result:

-5

ROUND(x,y)


Returns the argument x, rounded to the decimals specified in y. See ROUND(x).
Example:
SELECT ROUND(4.345, 1)
Result:


4.3

RPAD(x, y, z)


Returns the string of x right padded with the string z until the length of the return string is equal to y. See
LPAD().
Example:
SELECT RPAD("Mark", 8, "OK")
Result:
"MarkOKOK"


RTRIM(x)


Returns x without trailing spaces. See LTRIM() and TRIM().
Example:
SELECT RTRIM("Mark ")
Result:


"Mark"

SECOND(time)


Returns the second given in time.
Example:

Free download pdf