Use MySQL's own function to be cautious, say that it will affect the efficiency of data execution, the cost is too high. This also to distinguish between the reference category of fast software, such as the internal system business logic is more complex, the function point is very fine, but the concurrency is not very large, this time with the MySQL function can greatly reduce the business logic of the development of the difficulty (although said to be one-sided, can not be generalize, but there is a great use) While the external system business logic is relatively not very complex, the function point is relatively shallow, but the concurrency ratio is large, in order to reduce the server and database access pressure is best not to use the own function, the reason is simple is the performance problem.
1, theformat (x, y) function, the function is to place a number x, the y decimal place is reserved, and the integer part is separated by commas, the fractional part is rounded.
- Note : Once your data is separated by thousands of bits, it becomes a string . can provide a better experience for reading, but it is very difficult to calculate, so if you just keep the decimal, it is not recommended to use this function.
2,abs (); To find the absolute value of a number; absolute
3,sqrt (); Ask for the square root of a number. SQRT is the abbreviation for Sqruar (square, rectangle), root (Root).
4,mod (x, y) × divisor, y dividend. The end is the remainder.
5,ceil () into a rounding.
Floor () Rounding and rounding
These two functions are mirror functions, which are somewhat more interesting. These two functions are not rounded and are more robust.
6,rand () as the name implies, is used to generate random numbers.
7,format will automatically do thousands of bits, the following we look at the round function, to be rounded.
8,truncate (x, y) compare overbearing, regardless of rounding, directly to X, the y decimal place directly killed.
9, sign() returns the current result of the symbol, if a negative number returns-1, if 0 returns 0 if it is positive, returns 1.
10. Power() power operation
Original: Http://www.cnblogs.com/roverliang/p/5060756.html?utm_source=tuicool&utm_medium=referral
Common math functions for MySQL