Home > Database > Mysql Tutorial > body text

How to keep three decimal places in mysql

coldplay.xixi
Release: 2023-01-04 09:37:27
Original
10228 people have browsed it

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!

Related labels:
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!