For the length of the INT type in the Mysql field, thank you!

Source: Internet
Author: User
Example: tinyint (1) description: I understand that the maximum positive number of the Tinyint type is 255. What I don't understand is the purpose of setting 1 here. In fact, even if the length is set to 1, you can store any number greater than one digit. Q: Does it make sense to set the length limit without zero padding? Or... example: tinyint (1)

Note: I understand that the maximum positive value of the Tinyint type is 255. What I don't understand is the purpose of setting 1 here. In fact, even if the length is set to 1, any number greater than 1 can be saved.

Q: Does it make sense to set the length limit without zero padding? Or are there any other settings necessary?

Reply content:

Example: tinyint (1)

Note: I understand that the maximum positive value of the Tinyint type is 255. What I don't understand is the purpose of setting 1 here. In fact, even if the length is set to 1, any number greater than 1 can be saved.

Q: Does it make sense to set the length limit without zero padding? Or are there any other settings necessary?

Mysql specifies the width of the integer type, for example, int (11). This is meaningless for most applications: it does not limit the valid range of values, it only specifies the number of characters used by some mysql interaction tools (such as the mysql command line client. For storage and computing, INT (1) and int (20) are the same.

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.