The display bit width of MySQL----data

Source: Internet
Author: User

Problem: The columns in the MySQL table can define the bit width that it displays, so does the definition of bit width affect the range of data values?

Test:

1. Define a table for testing

CREATE table t (x int,y int (2), Z int (2) zerofill);

2. Insert the data for testing

INSERT into t (x, y, z) VALUES (9,9,9); #插入一些在范围内的数据.

INSERT into t (x, y, z) VALUES (100,100,100); #插入超出范围的数据.

3. Test:

select * from T;

    

Conclusion:

It is useful to display the width of a bit or to fill it by 0, but it does not work if the data exceeds that range.

The display bit width of MySQL----data

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.