How to remove the extra 0 after the decimal point in mysql
Updated: March 24, 2014 17:12:05 Author:
This article mainly introduces the method of removing the extra 0 after the decimal point in mysql. Friends who need it can refer to it
select cast(2.12000 as decimal(9,2)) result
2.12
select cast(2.10000 as decimal(9,2)) result
2.1
select cast(2.00000 as decimal(9,2)) result
2
2.12
select cast(2.10000 as decimal(9,2)) result
2.1
select cast(2.00000 as decimal(9,2)) result
2
Related Articles
How to optimize Mysql's million-level fast pagination
This article analyzes in an easy-to-understand manner how to optimize the fast paging of tens of millions of MySQL. It is very practical and is a rare article that is a must-read for programmers! !2014-09-09Summary of the usage of cast function in mysql
In MySQL, the CAST function is used to convert an expression to a specified data type. This article mainly introduces a summary of the usage of the cast function in mysql, which has certain reference value. If you are interested, you can learn about it.2023-12-12Comparison of usage methods of distinct and count(*) in MySQL
This article mainly compares the usage methods of distinct and count(*) in MySQL, and conducts a detailed analysis of the usage methods and efficiency between the two. Interested friends can refer to it.2015-11-11Quickly repair a corrupt MySQL database
After using MySQL for a long time, some problems may occur in the database. Most issues can be quickly fixed with simple operations. The following are two methods to quickly repair MySQL databases.2011-06-06JDBC Exploration SQLException Analysis
This article mainly introduces the SQLException analysis of JDBC exploration, which has certain reference value. Friends who need it can learn about it.2017-10-10MySQL window function OVER() usage and description
This article mainly introduces the usage and description of the MySQL window function OVER(), which is of good reference value and hopes to be helpful to everyone. If there are any mistakes or no complete considerations, I hope you will be very grateful for your advice2022-08-08MySQL Community Server 8.0.29 installation and configuration method graphic tutorial
This article mainly introduces the MySQL Community Server 8.0.29 installation and configuration method graphic tutorial. The installation steps in the article are introduced in detail and have a certain reference value. Interested friends can refer to it.2022-06-06How to reset the root password of mysql server in ubuntu
I installed mysql 5 server under ubuntu. I don’t know why. The root account password entered during installation cannot pass the verification of the database server anyway when using it. I had no choice but to reset mysql's root account password. After checking, I successfully reset my root account password by using the following method2012-10-10Detailed explanation of the database installation process of MySQL 5.7.24 version
This article mainly introduces the database installation process of MySQL 5.7.24 version. Friends who need it can refer to it.2018-11-11Special issue with mysql master and slave server configuration
If you modify the configuration of the master server, remember to delete the files on the slave server. Otherwise, the old configuration used from the server may cause errors.2010-12-12