码迷,mamicode.com
首页 > 其他好文 > 详细

Numeric Type Attributes

时间:2017-02-01 15:37:47      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:types   spec   store   whether   const   get   rom   span   ati   

Numeric Type Attributes

   INT(4) specifies an INT with a display width of four digits.

  This optional display width may be used by applications to display integer values having a width less than the width specified for the column by left-padding them with spaces. (That is, this width is present in the metadata returned with result sets. Whether it is used or not is up to the application.)

  主要是起补0作用。

  The display width does not constrain the range of values that can be stored in the column. Nor does it prevent values wider than the column display width from being displayed correctly. For example, a column specified as SMALLINT(3) has the usual SMALLINT range of -32768 to32767, and values outside the range permitted by three digits are displayed in full using more than three digits.

  数字位数超过时,正常存储。

  When used in conjunction with the optional (nonstandard) attribute ZEROFILL, the default padding of spaces is replaced with zeros. For example, for a column declared as INT(4) ZEROFILL, a value of 5 is retrieved as 0005.

  

参考:https://dev.mysql.com/doc/refman/5.7/en/numeric-type-attributes.html

Numeric Type Attributes

标签:types   spec   store   whether   const   get   rom   span   ati   

原文地址:http://www.cnblogs.com/tekkaman/p/6360005.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!