Tinyint data type in mysql, mysqltinyint

Source: Internet
Author: User

Tinyint data type in mysql, mysqltinyint

The mysql database defines the data type as "data type (m:


Here, the number m represents different meanings in different data types.


The integer system has limited the value range. For example, tinyint occupies one byte (8 bit) and int occupies four bytes.


Therefore, m after an integer is not the length of the data, but the minimum length of the data displayed (the length is the number of characters ).


Tinyint (1) here 1 indicates the minimum display width is 1 character.


Tinyint (2) here 2 represents the minimum display width is 2 characters, but here setting m is meaningless, you also need to specify what to fill with when the data is smaller than the length of m, such as zerofill (indicating that there is 0 filling ).


Set tinyint (2) zerofill. When you insert 1, it will display 01.


Set tinyint (4) zerofill. When you insert 1, it will display 0001.



Mysql Data Type tinyint

This should be controlled in the code. It cannot be displayed if it is directly queried in the database. Use the code to process the query results.

What is the MySQL Data Type problem?

0 to 255
The position is 1 byte.

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.