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

(singke) #1

ASIN(x)


Returns the arc sine of x. Returns NULL if x is not between –1 and 1.
Example:
SELECT ASIN(0.987)
Result:


1.409376

ASCII(x)


Returns the ASCII code of the first character in a string.
Example:
SELECT ASCII("A")
Result:


65
Example:
SELECT ASCII("Abc")
Result:

65

ATAN(x)


Returns the arc tangent of x.
Example:
SELECT ATAN(3)
Result:


1.249046

ATAN2(x, y)


Returns the arc tangent based on the signs given in the arguments to determine the quadrant.
Example:
SELECT ATAN(2,2)
SELECT ATAN(-2,2)
Results:


.785398

-.785398

AVG(expression)


This function returns an average of the numbers given in the expression provided in the argument. Only non-
NULL values are used in the average.
Example:
SELECT AVG(Price) FROM Customers
Results:


23 (Given that Price is a column in a table)

BENCHMARK(count, expression)


Performs the expression given in the argument count times. The value that it returns is always 0. The
important thing is the elapsed time that is given in the end. This allows you to judge how quickly the server
evaluates your queries.
Example:
SELECT BENCHMARK(20000, SELECT * FROM Customers)
Results:
The results will vary depending on certain key factors, such as server load. The results will always be 0
with an elapsed time.


BIN(x)


Returns a binary value of x, where x is a BIGINT. The return value type is a string.

Free download pdf