PrefaceDuring the development process, we often use the decimal data type. Because decimal is an accurate data type in MySQL. The data types in MySQL include: float, double and other imprecise data types and decimal, which are precise data types. Difference: For float, double and other inexact types, approximate values are stored in the DB. Decimal stores the exact original value in the form of a string. Introduction to decimal: decimal(a,b) Where: a specifies the maximum number of decimal digits that can be stored to the left and right of the decimal point, with a maximum precision of 38. b specifies the maximum number of decimal digits that can be stored to the right of the decimal point. The number of decimal places must be a value between 0 and a. The default number of decimal places is 0. Note: DECIMAL data types are used in calculations that require very high precision. These types allow the precision and counting method of the values to be specified as selection parameters. Precision here refers to the total number of significant digits stored for the value, while the count method indicates the number of digits after the decimal point. question When the length of the decimal type is less than 14, when inserting data into the decimal type field, the invalid decimal 0 will be automatically removed. Only when the length of the decimal type is greater than or equal to 14 digits, the invalid 0 in the decimal place will be retained and the decimal places will be automatically filled. Notice When the page is displayed, the data also needs to be formatted (decimal places), otherwise invalid 0s will be removed. This is the end of this article about the detailed explanation of the decimal padding problem of the decimal data type in MySQL. For more relevant MySQL decimal padding content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Windows Server 2016 Quick Start Guide to Deploy Remote Desktop Services
>>: Two ways to add a mask effect to the background image using background-color through CSS
This article uses the "Attribution 4.0 Inter...
In HTML, the Chinese phrase “學好好學” can be express...
Background of the problem The server monitoring s...
1. Dynamic Components <!DOCTYPE html> <h...
Preface: I have newly installed an Alibaba cloud ...
Table of contents Multi-application deployment 1-...
Linux virtual machine: VMware + Ubuntu 16.04.4 Wi...
Table of contents Controller type of k8s Relation...
View the dependent libraries of so or executable ...
This article shares the specific code of JavaScri...
1. <dl> defines a list, <dt> defines ...
If you want the path following the domain name to...
1. Background Although I have read many blogs or ...
Table of contents Backend: Rails API part Front-e...
Table of contents Preface Preview text Graphics C...