Home  >  Article  >  Database  >  How to keep three decimal places in mysql

How to keep three decimal places in mysql

coldplay.xixi
coldplay.xixiOriginal
2020-12-15 13:36:4410342browse

Mysql method of retaining three decimal places: first open and run the [mysql -uroot -p] command to enter mysql; then execute [select format (decimal, 2)] to retain 2 decimal places; finally run sql You can keep 2 decimal places and round.

How to keep three decimal places in mysql

The operating environment of this tutorial: windows7 system, mysql8.0.22 version, thinkpad t480 computer.

Related free learning recommendations: mysql video tutorial

Mysql method of retaining three decimal places:

1. Open and run interface, enter the cmd command, as shown in the figure below

How to keep three decimal places in mysql

#2. Enter the mysql -uroot -p command to enter mysql, as shown in the figure below

How to keep three decimal places in mysql

3. If decimals are not processed in mysql, they will be output as is, as shown in the figure below

How to keep three decimal places in mysql

4. Next Execute select format (decimal, 3) to retain 3 decimal places, as shown in the figure below

How to keep three decimal places in mysql

5. Run sql to retain 3 decimal places and round off , as shown in the figure below

How to keep three decimal places in mysql

6. Finally, writing 3 in the second parameter means retaining 3 decimal places, as shown in the figure below

How to keep three decimal places in mysql

Related free learning recommendations: php programming (video)

The above is the detailed content of How to keep three decimal places in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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