September 2010
Intermediate to advanced
440 pages
9h 23m
English
In addition to performing indexing and substituting on data, MySQL also allows for several ways of massaging the data to suit your needs. Some of the more common ones are discussed in this chapter.
As the name suggests, the mathematical function ROUND() serves to round decimal values to a specified number of places. The base value comes first in the syntax:
SELECT ROUND(base value, number of positions);
So rounding an already rough approximation of Pi would look like this:
mysql> SELECT ROUND(22/7, 2) as PI; +------+ | PI | +------+ | 3.14 | +------+ 1 row in set (0.00 sec)
The ROUND() function will accept whatever value you give it for the number of positions. However, if the number of places exceeds MySQL's built-in abilities ...
Read now
Unlock full access