Home > Database > Mysql Tutorial > body text

Commonly used basic operation syntax of mysql (12)~~Commonly used numerical functions [command line mode]

黄舟
Release: 2017-03-03 14:27:46
Original
1638 people have browsed it

Numerical function is one of the commonly used functions, and it is also a must for learning mysql. The commonly used ones are as follows:

1. ceil: Returns the smallest integer value greater than a certain number:
Commonly used basic operation syntax of mysql (12)~~Commonly used numerical functions [command line mode]

2. Floor: Contrary to the previous one, returns the largest integer value less than a certain number:
Commonly used basic operation syntax of mysql (12)~~Commonly used numerical functions [command line mode]

3. Round: Returns a certain value after rounding. The value of:
Commonly used basic operation syntax of mysql (12)~~Commonly used numerical functions [command line mode]
As shown above, the second parameter of round represents the number of decimal places that need to be retained.

4. Truncate: Returns the truncated value of a certain value:
Commonly used basic operation syntax of mysql (12)~~Commonly used numerical functions [command line mode]

The difference here from round is that no matter what the next decimal place is that needs to be retained, will be discarded directly. The same second parameter represents the number of decimal places that need to be retained.

Note: The above examples are all integers, but these functions can also handle negative numbers in the same way. There are more than these numerical functions, but I personally think these are more commonly used, so only these are recorded.

Numerical function is one of the commonly used functions, and it is also a must for learning mysql. The commonly used ones are as follows:
1. ceil: Returns the smallest integer value greater than a certain number:
Commonly used basic operation syntax of mysql (12)~~Commonly used numerical functions [command line mode]

2. Floor: Contrary to the previous one, returns the largest integer value less than a certain number:
Commonly used basic operation syntax of mysql (12)~~Commonly used numerical functions [command line mode]

3. Round: Returns the rounded value of a certain value:
Commonly used basic operation syntax of mysql (12)~~Commonly used numerical functions [command line mode]
As shown above, the second parameter of round represents the number of decimal places that need to be retained.

4. Truncate: Returns the truncated value of a certain value:
Commonly used basic operation syntax of mysql (12)~~Commonly used numerical functions [command line mode]

The difference here from round is that no matter what the next decimal place is that needs to be retained, will be discarded directly. The same second parameter represents the number of decimal places that need to be retained.

Note: The above examples are all integers, but these functions can also handle negative numbers in the same way. There are more than these numerical functions, but I personally think these are more commonly used, so only these are recorded.

The above is the content of the common basic operation syntax of mysql (12)~~common numerical functions [command line mode]. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!