INT (m) unsigned zerofill in MySQL

Source: Internet
Author: User

MySQL supports int (m) 'id' int (4) unsigned zerofill not null

Specify the display width (for example, INT (4) of the integer in the parentheses following the type keyword )).

It must be used in combination with the optional extension attribute zerofill, and the spaces supplemented by default are replaced by zero.

The zerofill attribute is unsigned at the same time. (Adding a negative value will report warnings or convert it to 0 by default)

If it is not used with zerofill, adding this m does not work.

Not only supports int, but also supports the entire int series tinyint (1 byte) smallint (2 byte) int (4 byte) bigint (8 byte)

For example, for a column declared as int (5) zerofill, value 4 is retrieved as 00004. The value 123456 is displayed as 123456.

Show warnings; displays warning information

When the display width is less than the specified column width, it is filled with 0 on the left.

The display width is not limited to the range of values that can be saved in the column (for example, the storage range of Int Is Always 4 bytes)

It does not limit the display of values that exceed the specified width of the column (normal display that exceeds the specified width ).

One problem is that when you use some client tools to query data, the front side may not be 0. note this.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.