DECIMAL Data Type

In MySQL, DECIMAL(M,D) and NUMERIC(M,D) are the same, and both have a precision of exactly M digits.

Leftover Digits    Number of Bytes
0             0
12            1
34            2
56            3
79            4

 For example,

DECIMAL(18,9) column has nine digits on either side of the decimal point, so the integer part and the fractional part each require 4 bytes.

DECIMAL(20,6) column has fourteen integer digits and six fractional digits.

The integer digits require four bytes for nine of the digits and 3 bytes for the remaining five digits.

The six fractional digits require 3 bytes.

posted @ 2016-06-27 00:59  zengkefu  阅读(332)  评论(0编辑  收藏  举报