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

(singke) #1

POW(x, y) and POWER(x, y)


Return the result of x raised to the power of y.
Example:
SELECT POWER(2,3)
Result:


8
Example:
SELECT POW(9,2)
Result:

81

QUARTER(date)


Returns the quarter of the year given in date.
Example:
SELECT QUARTER('2000-06-22')
Result:


2

RADIANS(x)


Returns the value of x given in degrees as radians. See DEGREES().
Example:
SELECT RADIANS(248)
Result:


4.328417

RAND() and RAND(seed)


Returns a random float type number in the range 0 to 1. If an argument is provided, it is used as the seed.
(A seed is used to generate the random number. The same seed will return the same series of random
numbers—making them not random but predictable.)
Example:
SELECT RAND()
Result:


.6847
Example:
SELECT RAND()
Result:

.1067
Example:
SELECT RAND(3)
Result:

.1811
Example:
SELECT RAND(3)
Result:

.1811

REPEAT(x, y)


Returns a string of x repeated y times. If y is less than 0, an empty string is returned.
Example:
SELECT REPEAT("Mark", 4)
Result:


"MarkMarkMarkMark"
Free download pdf