Length of int data type in mysql

Source: Internet
Author: User
Tags mysql index

After defining the int data type in mysql, what is the length entered later? The following describes the length of the int data type in mysql.

In mysql, the maximum length of the int data type is 11 bits and the minimum length is 4 bits.

This optional width specification is used to show the left fill of values whose width is shorter than the column width when the value is displayed, instead of limiting the width of the value stored in the column, or limiting the number of digits that can be displayed that exceed the specified width of the column. Note: If you store a larger value in an integer column that exceeds the display width, you may encounter problems when mysql generates temporary tables for some complex joins, in this case, mysql trust that all values are suitable for the original column width.

In mysql, int itself is 4 bytes. bigint is 8 bytes. So the meaning of int (X) is that int determines the size of the expected data column in bytes X.

In an SQL statement, int indicates the type of the field to be created, int indicates the integer type, and 11 indicates the length of the field.

The display width of an integer column is different from the number of characters required by mysql to display the value of this column. It has nothing to do with the size of the storage space required by this integer. For example, no matter how many characters the display width is set, bigint occupies 8 bytes.

MySQL inserts multiple records using INSERT

General INSERT usage in MySQL

Range of MySQL numeric data types

MySQL index type

This section describes the TIMESTAMP type in MYSQL.

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.